If you're wondering what control flow is, please check out this article https://cakebaby.dev/control-flow-in-python-with-conditional-statements by Ruth Ikegah
Now to calculate a leap year, you've to use this format:
A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400.
that's the way to calculate a leap year and we're going to use this format:
If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. The year is a leap year (it has 366 days). The year is not a leap year (it has 365 days).
# We're going to get input from the user
enter_year = input("Please enter a year: ")
# We're going to check if the user input is == number. We all know that
# whatever that's returned from the input is automatically converted to string
# but with isdigit(), we're going to know if the user input is a number.
# example: '123' will return true while 'ABC' will return false.
if enter_year.isdigit():
# Our leap year code will run here
# let's make our user input to an integer.
lep_year = int(enter_year)
if lep_year % 4 == 0:
if lep_year % 100 == 0:
if lep_year % 400 == 0:
print("The year is a leap year (it has 366 days).")
else:
print("The year is not a leap year (it has 365 days)")
else:
print("The year is a leap year (it has 366 days).")
else:
print("The year is not a leap year (it has 365 days)")
else:
print("i need a number not a string")