0
Can anyone help me to find out the real problem in this source code.
num = 59 if num <= 17: print("you are a child and not a voter") elif num >= 18: print("you are a voter and you must vote for you country") else: print("you are dead")
3 Antworten
+ 8
Your indentations are off. It should look like
num = 59
if num <= 17:
print("you are a child and not a voter")
elif num >= 18:
print("you are a voter and you must vote for you country")
else:
print("you are dead")
Moreover, assuming num is an integer, it'll always be either <=17 or >=18. So the "else" block would never really execute. Maybe instead of elif num>=18, you could do something like
elif 18<= num <= 122:
Then whenever someone uses a num bigger than 122 (age of the verified oldest person ever lived, according to wiki), your code would call them dead. 😅
+ 3
You're welcome :)
0
I don't know much about indentation back then.
Thanks for helping.