+ 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")
5 Antworten
+ 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
+ 4
It must be == not = .You're comparing not declaring
https://code.sololearn.com/cIrvAf5lUF2J/?ref=app
+ 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")
+ 1
thanks all