You need to dedent the last if clause
from this
Aside from that you only need an else clause alone. If a year is not a leap year, then the only other option is it is not a leap year. So hence you only need an else clause instead of a second if clause. Even if you were to check something else, it should be an elif clause, not two if's one after the other like that.
like this:
from this
for years in range (start, total): if years %4 == 0: print(years, " This is a leapyear.") if years %4 != 0: print(years, " This is not a leapyear.")to this:
for years in range (start, total): if years %4 == 0: print(years, " This is a leapyear.") if years %4 != 0: print(years, " This is not a leapyear.")As currently writen. The second if clause never executes as it is under the opposite condition's if clause causing it to never fire.
Aside from that you only need an else clause alone. If a year is not a leap year, then the only other option is it is not a leap year. So hence you only need an else clause instead of a second if clause. Even if you were to check something else, it should be an elif clause, not two if's one after the other like that.
like this:
for years in range (start, total): if years %4 == 0: print(years, " This is a leapyear.") else: print(years, " This is not a leapyear.")
Recommended Tutorials: