0 points

Use of only "if" statement with comparison operators


dashboard

Tue Apr 21 2020 10:34:57 GMT+0000 (UTC)

Posted by @AwesomeMe #python #python #ifstatement #comparisonoperators

People = 20
Cats = 30
Dogs = 15
# line 1,2 and 3 assigning values to variables 
If people < cats: #1st condition
print(“too many cats”)
If people > cats: #2nd condition
print(“not many cats.”) # 3rd condition
If people > dogs:
print(“ the world is dry.”)
                              
                                
content_copy Copy

The above code is a simple example of if statement and comparison operators. There is no other statement like elif, else etc.

https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914