[python practice questions] program 4

#Question : Enter a certain month and a certain day of a certain year, and determine which day of the year this day is? 
import time

year = input( ' Enter year: \n ' )
month = input( ' Enter month: \n ' )
day = input( ' input date: \n ' )

t = year.strip() + '-' + month.strip() + '-' + day.strip()
k = time.strptime(t,'%Y-%m-%d')
print(k.tm_yday)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325118084&siteId=291194637