If, elif, and else and Logic operator (And) in Python - Taleem Dunya

Lecture 09

If, elif, and else and Logic operator (And) in Python

It prompts the user to enter a GPA, evaluates the GPA value, and then prints different messages based on the conditions. However, I noticed a small issue in the elif condition. Instead of checking if gpa < 2 and gpa == 0, it should be checking if gpa >= 0 and gpa < 2. Here's the corrected version of your code:
Now the conditions are properly checked. If the GPA is greater than 2 and less than or equal to 4, it will print "Pass". If the GPA is between 0 and 2 (inclusive), it will print "Fail". If the GPA is less than 0, it will print "Less than 0 is not accepted". And if none of the conditions are met, it will print "Not accepted".