Link to home
Start Free TrialLog in
Avatar of snhandle

asked on

python calculating birthday

I am new to Python. try to learn. I want to create program where it should ask for birthday just day and month using input function and if the birthday is in the future then should give message that how many days left for your birthday, if it   is already passed then it should give message that your birthday was that many days ago and if it is today then should show message ‘happy birthday’
I spent lot of time but no luck
Avatar of aikimark
Flag of United States of America image

What is the current state of your Python code?
Avatar of snhandle


import datetime
today_date =
birthday = input(“enter your birth date (DD/MM):”)
if x > 0
print(your birthday has already passed by” (x))
if x < 0
print(“u still have (x) days left”)
if x = 0
print(“happy birthday”)
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Always very helpful!! Thanks a lot

You're welcome!