81.6k views
3 votes
Write a program that uses a dictionary to store students birthdays. Your program should ask the user what their name is, and look it up in the dictionary . If their birthday is known, it should tell them their birthday.

User Ceottaki
by
5.8k points

1 Answer

6 votes

di = {"student":"10/30/1984", "student2":"11/16/2020"}

name = input("What is your name? ")

if name in di:

print(di[name])

else:

print("Your name is not in the dictionary.")

You can change the values inside the dictionary. I hope this helps!

User ForYourOwnGood
by
6.3k points