if/elif/else statements in python
When you need to include a selection part into a python program, you can use the if statement with a condition.
If you want to add only one condition to the program you can use if and else statements.
If you want to add only one condition to the program you can use if and else statements.
Lets see how to use that statements using an example.
if / else
In this code we can find the largest number among the inputted two numbers.
This code give output (pass or fail) according to the mark inputted from the user.
if / elif / else
When user want to add more than one condition then user can use if, elif and else statements.
This program is created for find the largest number among the inputted three numbers.
0 comments:
Post a Comment