0
LEAP YEAR One of the locked answers are not going donât know y (showing work )
Donât know why examples number 3 and 4 donât pass and they are locked ones # didnât fit together with the other question year = int(input()) a = (year % 4) b = (year % 100) c = (year % 400) if a == 0: if b == 0: if c == 0: print ('Leap year') if a or b or c ! = 0: print ('Not a leap year') {added} For any answer just to pass I can do see answer but Iâm trying to code the answer my way and trying to understand the how coding works not just getting answers to pass the tests on sololearn soâŠ.
3 Respostas
+ 1
This might help
https://www.wikihow.com/Calculate-Leap-Years
I'm not too sure with the working of the second `if` block
if a or b or c > 0:
0
Compare this with your code and figure out.
https://code.sololearn.com/cEZCv6Ldtp0a/?ref=app
Alternatively you can write,
if a == 0:
if (b==0 and c==0) or (b!=0 and c!=0):
print('Leap year')
else:
print('Not a leap year')
else:
print('Not a leap year')
try this
0
same discussion.
else part missing also..
https://www.sololearn.com/discuss/3085077/?ref=app