如果有 months = "Jan.Feb.Mar.Apr.May.Jun.Jul.Aug.Sep.Oct.Nov.Dec.",编写一个程序,用户输入一个月份的数字,输出月份的缩写。
当输入的数字不a=input()
b=int(a)
x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
if 1<=b<=12:
print(x[b-1])
else:
print('请输入1~12之间的数字!')在1~12之间时,输出“请输入1~12之间的数字!”
© 2021 Python学习网 苏ICP备2021003149号-1