24th Dec 2018, 5:43 PM
Manas Kesharwani
Manas Kesharwani - avatar
4 Antworten
+ 8
print('You', ("are under 18 you can't", 'can')[age >= age_a], 'vote')
24th Dec 2018, 7:56 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 3
You can use this pattern: print( ... if condition else ... )
24th Dec 2018, 5:49 PM
Kirk Schafer
Kirk Schafer - avatar
+ 3
print('You', 'can' if int(input('Your age:')) >= 18 else 'are under 18 you cant', 'vote')
24th Dec 2018, 7:37 PM
Anna
Anna - avatar
+ 2
Mert Yazıcı 👌😊
24th Dec 2018, 8:03 PM
Anna
Anna - avatar