0
Error in code
Any idea what's wrong with the code below? Cheers. year = int(input("Enter Year: ")) if year % 4 == 0 and year % 100 != 0: print(year, "is a Leap Year") elif year % 100 == 0: print(year, "is not a Leap Year") elif year % 400 ==0: print(year, "is a Leap Year") else: print(year, "is not a Leap Year")
8 ответов
+ 2
Why did you use ‘year % 100’ thing? You simply could use ‘%4’ thing.
+ 1
Okay, what do you use for indentation? 2 spaces, 4 spaces, a tab?
+ 1
I had no idea about any indentation so the empty spaces were always random within a block and that's why I got the messages.
I've just watched some videos and now I know what to do.
Thanks for the hint.
+ 1
That's a mistake. It shouldn't be there.
0
What is the error?
0
https://www.sololearn.com/discuss/2922796/?ref=app
https://www.sololearn.com/discuss/2690057/?ref=app
https://www.sololearn.com/discuss/1215251/?ref=app
https://www.sololearn.com/discuss/2876106/?ref=app
https://www.sololearn.com/discuss/2930541/?ref=app
https://www.sololearn.com/discuss/2590381/?ref=app
https://www.sololearn.com/discuss/1330744/?ref=app
https://www.sololearn.com/discuss/2767327/?ref=app
https://www.sololearn.com/discuss/2286903/?ref=app
https://www.sololearn.com/discuss/2831198/?ref=app
https://www.sololearn.com/discuss/2819261/?ref=app
https://www.sololearn.com/discuss/2800019/?ref=app
https://www.sololearn.com/discuss/661776/?ref=app
https://www.sololearn.com/discuss/2684084/?ref=app
https://www.sololearn.com/discuss/2834100/?ref=app
0
I see nothing wrong with it, and it runs perfectly fine
0
It's okay now but I got the following message yesterday: "expected an indented block"
I actually get the same message quite often when doing practice after lessons.