DEV Community

Durga Pokharel
Durga Pokharel

Posted on • Edited on

1

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

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay