def main(): # Create an empty list for the month numbers month_num = [] # fill the empty list with the numbers for i in range(1, 13): month_num.append(i) # lists each name of each month month_name = ['January', 'Febuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] month = int(input('please enter the month number: ')) # Create empty lists set1 = [] set2 = [] set3 = [] # create empty day list day = [] # fill the list with the number of days in a month for i in range(1, 31): day.append(i) current_day = int(input('please enter the current day: ')) year = int(input('please enter the year: ')) # if the month number entered is in the list, fill set1 with the corresponding month name for i in month_num: if month_num[i-1] == month: set1 = month_name[i-1] # if the day number entered is in the list, fill the set2 with the corresponding day name for i in day: if current_day == day[i-1]: set2 = day[i-1] set3 = year set1 = str(set1) set2 = str(set2) set3 = str(set3) print (set1 + ' ' + set2 + ',' + ' ' + set3) main()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question