This simple program that I have created will tell you the exact date of BIRTH visually without any complex coding.
The code are as follows:-
import time, calendar #Enter date in this format -> 19990606 # i.e. Year-month-day #That is 1999 - Year, 06 - month, 06 - day dt = input('') a = (dt[0:4]) b = (dt[4:6]) c = (dt[6:8]) print ('Your Date of Birth is:') print (c + '-' + b + '-' + a) x = str(a) + "-" + str(b) + "-" + str(c) y = time.strftime("%A", time.strptime(x,"%Y-%m-%d")) print ('The Day was ' + y) d = calendar.TextCalendar(calendar.SUNDAY) d.prmonth(int(a), int(b))
First for your kind info we are using python3+ not python2.7
We will now import time and calendar.
We are going to give it input function so after running the code it will ask for our input.
And the input will be in following format i.e.
(YOUR FULL DATE OF BIRTH)
Year - Month - Day
Eg. 1999 - 06 - 06
We will not use dash ( - ) so we will only type in 19990606
We will make Sunday as the starting week therefore we use callendar.SUNDAY
And we get the output as...
Your Date of Birth is: 06-06-1999 The Day was Sunday June 1999 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Try this code 🔴LIVE here
👉 https://code.sololearn.com/c9EyW4pQmCcl
Python is simple and fun to play with and yet very powerful. 🔥