3.0.2 - Some nests hide many IFs in Python


Once you are feeling comfortable with the if, elif, and else statements, you can move on to nested conditional statements. We can use nested if statements for situations where we want to check for a secondary condition if the first condition executes as true. For this, we can have an if-else statement inside of another if-else statement. Let’s look at an example:


Don't forget the indentation!

Also, have you noticed the , end="" inside the parenthesis in print command?

Remove it and run the program again to see the difference.

Also, change the print command line with the following :

print("You have passed with grade ", end =": ")

What is the conclusion?

A print command without end inside the parenthesis, inserts a new line. With end we can change the end of the line from new line to whatever we like!