Answers for "python conditional one line"

1

python in line conditional statement

>>> age = 15
>>> print('kid' if age < 13 else 'teenager' if age < 18 else 'adult')
teenager
Posted by: Guest on August-17-2021
4

one line if statement python

var = [expression1] if [condition] else [expression2]
Posted by: Guest on December-03-2020

Code answers related to "python conditional one line"

Python Answers by Framework

Browse Popular Code Answers by Language