Answers for "python and if"

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 and

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

python if condition

if my_condition:
  # Do some stuff
  print("Hello You!")
else:
  # Do some stuff
  print("Hello World!")
Posted by: Guest on January-16-2021
1

python if

if num==5:
  print("Num equal to 5")
elif num > 5:
  print("Num more than 5")
else:
  print("Num smaller than 5 but not equal to 5")
Posted by: Guest on March-06-2021
0

or in if statement python

weather == "Good!" or weather == "Great!": 

# Or the following  

weather in ("Good!", "Great!"):
Posted by: Guest on April-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

Python Answers by Framework

Browse Popular Code Answers by Language