0
Plzz help why this code is not working propely, its printing only first statement?
alien = 'green' or 'yellow' or 'red' if alien == 'green': print('earned 5') if alien == 'yellow': print('earned 10') if alien == 'red': print('earned 15') output: earned 5
3 RĂ©ponses
+ 2
A variable (say, var) canât be âxâ or âyâ or âzâ where it will return True if var is equal to one of âxâ, âyâ or âzâ.
You can have
var = (âxâ, âyâ, âzâ)
and say
if âxâ in var:
print(...)
if âyâ in var:
print(...)
if âzâ in var:
print(...)
+ 2
You have created this question twice. Would you mind deleting 1
https://www.sololearn.com/Discuss/1713249/?ref=app
0
you are right thanks for helpling.. its working fine..
alien1 = 'green,yellow,red'
if 'green' in alien1:
print(earned 5)
....
...