0% found this document useful (0 votes)
5 views

Pycharm Code Case Statement month

Uploaded by

ahsantech33
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Pycharm Code Case Statement month

Uploaded by

ahsantech33
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

25 - October - 2024

def main():
try:
month_no = int(input("ENTER MONTH NUMBER: "))

match month_no:
case 1:
month_name = "January"
case 2:
month_name = "February"
case 3:
month_name = "March"
case 4:
month_name = "April"
case 5:
month_name = "May"
case 6:
month_name = "June"
case 7:
month_name = "July"
case 8:
month_name = "August"
case 9:
month_name = "September"
case 10:
month_name = "October"
case 11:
month_name = "November"
case 12:
month_name = "December"
case _:
month_name = "Invalid Month Number Entered"

print(month_name)
except ValueError:
print("Please enter a valid integer for the month number.")

main()

You might also like