Questions: ```
inputyear = int(input())
if input year % 4 ==0:
if input year % 100==0:
if input year % 400=0:
isleap year = True
plse:
isleap year = True
if isleap year:
print(f'inputyear - leap year')
else:
print(f'input year - not a leap year')
```
Transcript text: ```
input_year = int(input())
if input year % 4 ==0:
if input year % 100==0:
if input year % 400=0:
is_leap year = True
plse:
is_leap year = True
if is_leap year:
print(f'{input_year} - leap year')
else:
print(f'{input year} - not a leap year')
```
Solution
Solution Steps
Step 1: Initialize the is_leap_year variable
The code starts by initializing a boolean variable is_leap_year to False.
Step 2: Input the year
The code takes an integer input from the user and stores it in the variable input_year.
Step 3: Check divisibility by 4
The code checks if input_year is divisible by 4 using the condition if input_year % 4 == 0:. If true, it proceeds to the next step.
Step 4: Check divisibility by 100
Within the previous condition, the code checks if input_year is divisible by 100 using the condition if input_year % 100 == 0:. If true, it proceeds to the next step.
Step 5: Check divisibility by 400
Within the previous condition, the code checks if input_year is divisible by 400 using the condition if input_year % 400 == 0:. If true, it sets is_leap_year to True. If false, it does not change is_leap_year.
Step 6: Handle non-century years
If input_year is divisible by 4 but not by 100, the code sets is_leap_year to True.
Step 7: Print the result
The code checks the value of is_leap_year. If True, it prints that the year is a leap year. Otherwise, it prints that the year is not a leap year.
Final Answer
The code correctly determines whether a given year is a leap year or not based on the rules of the Gregorian calendar.