Answers for "if 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
1

if something in something python example

name = "Steve"
if "St" in name:
  print(True)
else:
  print(False)
  
/'''
if "St" in name:
	Mean's To Check If The Name Contain's (St)
    
Return's True Because We Steve Contain's (St)
'''/
Posted by: Guest on July-08-2021
6

python if and

if foo == 'abc' and bar == 'bac' or zoo == '123':
  # do something
Posted by: Guest on December-22-2020
0

if statement python

x = int(input("number: ")) # get number from user

if x < 0:
  print(f"{x} is less than 0!") # if x is less than 0, print x is less than 0
  
elif x == 0:
  print(f"{x} is equal to 0!") # if x is equal to 0 then print x is equal to 0
  
if x > 0:
  print(f"{x} is more than 0!") # if x is greater than 0 print x is more than 0

# yeah its me somewhatoriginal
Posted by: Guest on May-03-2021
0

python if

def e(x):
	if x == "Sunny" and x == "sunny":
  		print('Remember your sunglasses!')
	elif x == "Rainy" and x == "rainy":
  		print('Do not forget your umbrella!')
	elif x == 'Thunderstorm' or x == 'thunderstorm' or x =='Stormy' or x == 'stormy':
      print('Stay Home!')
    
x = input('What is the weather?')
Posted by: Guest on October-02-2020
-1

if something in something python example

name = "Stev"
if name in "e":
  print(True)
else:
  print(False)
 
# (if name in "e") means if name contain's (e)
Posted by: Guest on July-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language