+ 1
Expected an indented block
when i do the print command it shows me this error. i have seen it several times but i don't know what this is. help me i want to fix it please. https://code.sololearn.com/ct9Z94gCttMv/?ref=app
11 Respuestas
+ 2
# Roman Numerals
x= int(input("Give a number from 1 to 20"))
print("\n")
if x==1:
print("I")
elif x==2:
print("II")
elif x==3:
print("III")
elif x==4:
print("IV")
elif x==5:
print("V")
elif x==6:
print("VI")
elif x==7:
print("VII")
elif x==8:
print("VIII")
elif x==9:
print("IX")
elif x==10:
print("X")
elif x==11:
print("XI")
elif x==12:
print("XII")
elif x==13:
print("XIII")
elif x==14:
print("XIV")
elif x==15:
print("XV")
elif x==16:
print("XVI")
elif x==17:
print("XVII")
elif x==18:
print("XVIII")
elif x==19:
print("XIX")
elif x==20:
print("XX")
else:
print("Your Input Is Incorrect")
+ 4
Indentation isn’t optional in Python. Use Tab or 4 spaces. Like this:
if x == 1:
print(“I”)
else:
print(“other”)
+ 2
I looked through your code, and i think you forgot to mark the end of the lines with a ";" and you might have added an indent to the end of lne 5 without noticing.
+ 2
ok, well you can try google. I'm out of ideas.
+ 2
You need to ident every piece of code you want in an if or else clause. In your case, every print should be idented.
+ 2
i am leaving now so c ya tomorrow. thanks for help
+ 2
so Xan you are saying that i should add this line print("\n") or i should put it in every line after I or IV
+ 1
hmmm i dont think so... i did not found any ;
+ 1
Changes made:
1) indented all print() functions after elifs and elses
2) added the print("\n") to ensure the output is on a newline. Try commenting the print("\n) out
+ 1
guys i want to thank you. i ended the program
0
Pedro Demingos i have multiple lines in my code so i added the elif command else-if means elif i think