Computer Science, asked by InshaHashmi7237, 5 days ago

Class X Computer Applications Project / Home Work - May 20211. Input a month number and year. Check validity. Year must be a fourdigit positive integer. If valid, print month name and check if the yearinputted is a leap year.Example 1: Input : Month number: 14Output : Wrong month numberExample 2: Input : Month number: 7Year: 2020Year is a leapOutput: Month name : Julyyearclass 10 icse, st jhons dlwsec- C , apoorv

Answers

Answered by aryanroy2204
0

Answer:

dictionary = {1: 'January', 2: 'February', 3: 'March', 4: 'April', 5: 'May', 6: 'June', 7: 'July', 8: 'August', 9: 'September', 10: 'October', 11: 'November', 12: 'December'}

month_num = int(input("Month Number: "))

if month_num not in range(1, 13):

   print('Wrong Month')

else:

   year = int(input("Year: "))

   if year % 4 == 0:

       answer = "Year is a leap"

   else:

       answer = "Year is not a leap"

   month_name = dictionary.get(month_num)

   print(answer)

   print("Month Name:", month_name)

Similar questions