Snippets Collections
People = 30
Cars = 40
Trucks = 14
# line 1,2,3 assign the value to variables
If cars > people: Using if statement
  Print(“we should take the  cars.”)
Elif cars < people: if 1st is false execute elif
  print(“we should not take the car.”)
else : # if both are false then execute else:
    print(“we can’t decide.”)
                               
                                
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 11:15:59 GMT+0000 (Coordinated Universal Time) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python #python #condition #ifstatement #elifstatement #elsestatement
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