如何用python写月份

用python写月份的方法:
调用input方法输入月份,用if elif循环结构筛选符合条件的信息,然后再用print打印运行结果
month = int(input('Month:'))  if month in [3,4,5]:
      print('春季')
  elif month in [6,7,8]:
      print('夏季')
  elif month in [9,10,11]:
      print('秋季')
  elif month in [12,1,2]:
      print('冬季')
  else:
      print('请输入正确值:')
示例以及运行结果:
以上是 如何用python写月份 的全部内容, 来源链接: utcz.com/z/540974.html

