Compare Variables

#!/usr/bin/evn python

# Assign values in two variables
a, b = 5, 2

# If codition
if a > b:
    # {} use to print value
	print("A {} is greater than B {}".format(a,b))

# Else codition
else:
    # {} use to print value
	print("A {} is less than B {}".format(a,b))


# Conditional statement
print("A" if a < b else "B")


#***** Output *****
A 5 is less than B 2
B

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!