Snippets Collections
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.”)
                              
                                
x = int(input("Please enter an integer: "))
Please enter an integer: 42 #getting input from user
>>> if x < 0: #1st condition
...    x = 0
...    print('Negative changed to zero')
... elif x == 0: #2nd condition
...    print('Zero')
... elif x == 1: #3rd condition
...    print('Single')
... else: #4th condition
...    print('More')                               
                                
1.People = 30
2.Cars = 40
3. Trucks = 14
     # line 1,2,3 assign the value to variables
4.If cars > people: #Using if statement
   5.Print(“we should take the  cars.”)
6.Elif cars < people: #if 1st is false execute elif
     7.print(“we should not take the car.”)
8.else : # if both are false then execute else:
          9.print(“we can’t decide.”)
star

Tue Apr 21 2020 10:34:57 GMT+0000 (Coordinated Universal Time) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python #python #ifstatement #comparisonoperators
star

Tue Apr 21 2020 06:41:13 GMT+0000 (Coordinated Universal Time) https://docs.python.org/3/tutorial/controlflow.html

#python #python #ifstatement #elifstatement #elsestatement #comparisonoperators
star

Mon Mar 30 2020 12:04:52 GMT+0000 (Coordinated Universal Time) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python #python #ifstatement #elifstatement #elsestatement #comparisonoperators

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension