if and else in python
# if and else uses in statement.
a=45
b=30
c=75
if a<b:
print('45 is greater than 30')
else:
print('c is sum of a and b')
output:
c is sum of a and b
if and else in python
# if and else uses in statement.
a=45
b=30
c=75
if a<b:
print('45 is greater than 30')
else:
print('c is sum of a and b')
output:
c is sum of a and b
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
if statement python
temperature = float(input('What is the temperature? '))
if temperature > 70:
print('Wear shorts.')
else:
print('Wear long pants.')
print('Get some exercise outside.')
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?')
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us