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

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay