Answers for "how to use multiple if statements in python"

11

if else python

# IF ELSE ELIF 

print('What is age?')
age = int(input('number:')) # user gives number as input
if age > 18:
    print('go ahead drive')
elif age == 18:
    print('come personaly for test')
else:
    print('still underage')
Posted by: Guest on August-12-2020
6

python if elif

num = 20
if num > 30:
  print("big")
elif num == 30:
  print("same")
else:
  print("small")
#output: small
Posted by: Guest on May-09-2020
0

how to add multiple if statements in python

var = 100
if var < 200:
   print "Expression value is less than 200"
   if var == 150:
      print "Which is 150"
   elif var == 100:
      print "Which is 100"
   elif var == 50:
      print "Which is 50"
   elif var < 50:
      print "Expression value is less than 50"
else:
   print "Could not find true expression"

print "Good bye!"
Posted by: Guest on June-03-2021

Code answers related to "how to use multiple if statements in python"

Python Answers by Framework

Browse Popular Code Answers by Language