0
Anyways to make it shorter in python
4 Antworten
+ 8
print('You', ("are under 18 you can't", 'can')[age >= age_a], 'vote')
+ 3
You can use this pattern:
print( ... if condition else ... )
+ 3
print('You', 'can' if int(input('Your age:')) >= 18 else 'are under 18 you cant', 'vote')
+ 2
Mert Yazıcı 👌😊