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

1 Answer

0 votes
by

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

Related questions and answers

0 votes
asked Jun 28, 2020 in Python by Robindeniel
0 votes
asked Feb 11, 2021 in Python by SakshiSharma
0 votes
asked Dec 22, 2019 in Python by rajeshsharma
...