+ 2
Please help having error (showing my work)(other question one next on because it exceeded the word limit )
It says Iām using. āāvariable āiā before assignment āā but i assigned it already year = int(input()) a = (year % 4) b = (year % 100) c = (year % 400) a = 'i' i == 0 if a == 0: i += 1 else: print ('Not a leap year') if b == 0: i += 1 else: print ('Not a leap year') if c == 0: i += 1 if a >= 3: print ('Leap year') else: print ('Not a leap year')
5 Answers
+ 1
Also, you don't necessarily need to assign a b and c.
You can use embedded if statements.
You can write it like so:
year = input(int("what year is it?"))
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print:("it is a leap year")
else:("it is not a leap year")
else:print("it is a leap year")
else:print("not a leap year")
+ 1
Darkjedi
Yes i tried the same way you did with one mostake the second else i made to ānot leap year ā but your ways correct
+ 1
Darkjedi
When i did as you said it still gave me the same message
First:
i == 0
Then:
a == "i"
+ 1
There are many errors, but the way you posted the question makes it difficult to help. Let's first fix the question:
1. Paste your code in Code Playground
2. Remove the code from the question description
3. Add in the question description a link to your code in Code Playground
4. Explain your difficulties in the question description
Then we'll address the syntax and logic issues.
0
Yes, you are.
Correction should assign i before trying to assign it to a
First:
i == 0
Then:
a == "i"