+ 1

please help me !

I'm newbie. I dont know what my wrong ! year = int(input()) #your code goes here if year % 4 = 0: if year % 100 = 0: if year % 400 = 0: print("Leap year") else: print("Not a leap year") else: print("Leap year") else: print("Not a leap year")

15th Mar 2021, 10:01 AM
Hậu Trần Văn
Hậu Trần Văn - avatar
5 Answers
+ 6
You are using = which is an assignment operator. To check if two things are equal, use == Line 1 is ok Lines 3, 4, 5 not ok
15th Mar 2021, 10:11 AM
David Ashton
David Ashton - avatar
+ 4
It must be == not = .You're comparing not declaring https://code.sololearn.com/cIrvAf5lUF2J/?ref=app
15th Mar 2021, 10:11 AM
!Derrickee
!Derrickee - avatar
+ 2
missing equal comparison operator == what you did is if year % 4 = 0 but what you should do iis if year % 4 == 0 with double equal = sign year=int(input("enter a year: ")) if (year % 4) == 0: if (year % 100) == 0: if (year % 400) == 0: print(f"{year} is a leap year") else: print(f"{year} is not a leap year") else: print(f"{year} is a leap year") else: print(f"{year} is not a leap year")
15th Mar 2021, 10:13 AM
iTech
iTech - avatar
15th Mar 2021, 7:22 PM
David Ashton
David Ashton - avatar
+ 1
thanks all
15th Mar 2021, 10:17 AM
Hậu Trần Văn
Hậu Trần Văn - avatar