Mon Jul 19 2021

Compare Variables

File Name: compare-variable.py

#!/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

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