Categories

Dec 22, 2019 in Python

Q: How Do You Write A Conditional Expression In Python?

1 Answer

Dec 22, 2019

We can utilize the following single statement as a conditional expression. default_statment if Condition else another_statement

>>> no_of_days = 366

>>> is_leap_year = "Yes" if no_of_days == 366 else "No"

>>> print(is_leap_year)

Yes

Click here to read more about Python
Click here to read more about Insurance

Related questions

Madanswer
Aug 30 in Python
Dec 19, 2019 in Python
Dec 19, 2019 in Python
...