我正在编写一个程序,用户将在当天月份和年份输入3个数字,并将以2014年1月2日的格式输出。这样做将用户输入日期(2014年1月4日)转换为(2014年1月4日)
year =input("what year is it")
month=int(input("what is the numerical value of the month"))
day=input("what number day is it")
if month == 1:
January = str(month)
if day == 1 or 21 or 31:
print (day+"st January",year)
elif day == 2 or 22:
print (day+"nd January",year)
elif day ==3 or 23:
print (day+"rd January",year)
elif day == 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 18 or 19 or 20 or 24 or 25 or 26 or 27 or 28 or 29 or 30:
print (day+"th January",year)
我所遇到的问题是,一天,当我输入如4将输出中的4ST一月2014 我使用python 3和已经学会了和while循环并且如果声明如果有帮助
或者在'[1,21,31]'' – ThinkChaos
''看看我现在出错的地方现在谢谢 – Pudie12