0
Why 100!=0? i don't understand
year = int(input()) if year%4!=0: print("Not a leap year") elif year%100!=0: print("Leap year") elif year%400==0: print("Leap year") elif year%400!=0: print("Not a leap year")
5 odpowiedzi
+ 6
The code you provided is related to checking if a given year is a leap year or not. The code is correct and will output "Leap year" if the year is a leap year, and "Not a leap year" if the year is not a leap year.
Regarding your question about 100!=0, it's important to note that the != operator in Python means "not equal to". So 100!=0 means "100 is not equal to 0", which is true. However, this expression is not related to the leap year calculation in the code you provided.
In the leap year calculation, the logic is as follows:
If the year is not divisible by 4, it's not a leap year.
If the year is divisible by 4 but not divisible by 100, it's a leap year.
If the year is divisible by both 100 and 400, it's a leap year.
If the year is divisible by 100 but not divisible by 400, it's not a leap year.
This logic is based on the rules for calculating leap years in the Gregorian calendar, which is the calendar used by most of the world today.
+ 4
Previously discussed..
hope it helps..
https://www.sololearn.com/discuss/3061453/?ref=app
https://www.sololearn.com/discuss/3173957/?ref=app
https://www.sololearn.com/discuss/2995972/?ref=app
+ 3
Yes but not here.
Make your own question.
+ 2
How 100 == 0? I don't understand.