Computer Science, asked by diljotsinghdhillon, 11 months ago

write a Python program to read a month number and print the corresponding month name​

Answers

Answered by sayendutta1998
11

Answer:

i=int(input("Enter a month number"))

if i==1:

  print("January")

elif i==2:

  print("February")

elif i==3:

  print("March")

elif i==4:

  print("April")

elif i==5:

  print("May")

elif i==6:

  print("June")

elif i==7:

  print("July")

elif i==8:

  print("August")

elif i==9:

  print("September")

elif i==10:

  print("October")

elif i==11:

  print("November")

elif i==12:

  print("December")

else:

  print("Wrong input")

Answered by Jasleen0599
0

A Python program to read a month number and print the corresponding month name​

months_in_year = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

date = '2021-11-21 11:22:03'

month = date.dt.month

print(month)

#Output

12

month_name = months_in_year [month - 1]

print(month_name)

#Output

December

#SPJ2

Similar questions