Luis Rios
0
Q:

how to do if= python


a = 33

b = 200

if b > a:
  print("b is greater than a")
 
3
#Conditionals statements in python
#'=' conditionals statements
a = 123
b = 123

if(a==b):
  print('True')
  
#<, > conditionals statements

a = 2
b = 45

if(a<b):
  print('A is smaller than B')
  
4
if (condition):
   result
    
else:
   result
13
#a statement that checks if a condition is correct
#example:
x=5
if x == 5:
  print("x is 5")
else:
  print("x is not 5")
1
x=1; y=0; z=0;
if 1 in {x,y,z}:
  print('At least one variable is equal to 1')
9
answer = input(":")
if answer == "lol":
  print("haha")
else:
  print("not haha")
  exit()

please note that the exit() command is optional and is not necessary.
6

a = 33

b = 33

if b > a:

	 
	print("b is greater than a")

elif a == b:

	 
	print("a and b are equal")

 
1
x=1; y=0; z=0;
if x==1 or y==0:
  if z=0 and x=1:
    print('Useless conditions satisfed!')
8
#if you are doing this
if X=1
#Do this
if X==1
0
x = True

#Only one of the branches will ever execute
if x == True:
	print("x is true")
elif x == False:
	print("x is false")
else:
	print("x is neither true nor false")
0

New to Communities?

Join the community