DEV Community

Durga Pokharel
Durga Pokharel

Posted on • Edited on

Day 36 Of 100DayOfCode: Birthday Dictionary

This is my 36th day of #100DaysOfCode and #python. I practiced database using python. Made some table. Completed some assignment.
Tried to write some code in different topic.

I tried to write one birthday dictionary. In which we put name of persons as a key and birthday dates as a value.

Birthday Dictionary

At first we importing time library. And there is Birthdays as a dictionary name. There are four key and value. Then there is time.sleep(1) which help to appear letter inside print in 1 sec. My rest of code is given below.

import time
Birthdays ={
    "Durga Pokharel": "30/6/1997",
    "Barsha Bhandari": "28/10/1998",
    "Crystal Bhattarai": "24/2/2015",
    "Shubekshya Pandey":"13/2/2012",
}
print("Welcome to the Birthday special. Please wish  person who have birthday ! We have the birthdays to:")
time.sleep(1)
for x in Birthdays:
    print(x)
    time.sleep(0.7)
choice= input("\nWho's birthday do you want to look up?")

if choice in Birthdays:
    print("The birthday of {} is: ".format(choice))
    print(Birthdays[choice])
Enter fullscreen mode Exit fullscreen mode

Output of the code is,

Welcome to the Birthday special. Please wish  person who have birthday ! We have the birthdays to:
Durga Pokharel
Barsha Bhandari
Crystal Bhattarai
Shubekshya Pandey

Who's birthday do you want to look up?Durga Pokharel
The birthday of Durga Pokharel is: 
30/6/1997
Enter fullscreen mode Exit fullscreen mode

Day 36 Of #100DaysOfCode and #Python
* More About Database Using Python
* Python Dictionary
* Python function
* Birthday Dictionary#100DaysOfCode ,#CodeNewbies, #beginner pic.twitter.com/4LdzrTa7Mx

— Durga Pokharel (@mathdurga) January 29, 2021

Top comments (0)