Saved Bookmarks
| 1. |
Given a year, check if the year is leap year or not. If yes, the output should be "Leap Year". Else output should be "Not a Leap Year". The input should be a positive four digit number. Else, the output should be "Invalid Year". |
Answer» In PythonLeap year programmey = int (input ( " Enter Year ")) a = len (y) if a == 4: ____if ( y%400==0) or (y % 4 ==0 and y%100 != 0) : ________print (" Leap year") ____else : ________print (" Not a leap year ") ELSE: ____print (" Invalid year ") About some function that I am USING in programmeint () - For integer number. len () - Use to find the length. PRINT () - Use to print the message. note : I am using '___' these line for indentation (space ) imagine it invisible. |
|