- 2
a = 2 if a == 1: print("one") else: if a == 2: print("two") else: if a == 3: print("ok")
Error
6 odpowiedzi
+ 1
What you want to achieve can be done with elif keyword .
just write
elif for else if
+ 1
IndentationError in your code. Check this:
https://code.sololearn.com/cM1Q635XD8Br/?ref=app
0
Bro but two stop but error bro
0
But it's more correct to use elif here.
https://code.sololearn.com/ci0p9pBgPxrF/?ref=app
0
Nikolai Ivanov Haha, I literally don't know why I said so.
Thanks for notifying me .
0
a = 2
if a == 1:
print("one")
else:
if a == 2:
print("two")
else:
if a == 3:
print("ok")
two