Lesson 3: Control flow using if... elif... else

posted Oct 20, 2017, 7:56 AM by Attila Lengyel   [ updated Oct 20, 2017, 8:00 AM ]
a = input("Give me a number:")
b = input("Give me another:")
print("A=", a, "and B=", b)

if int(a) > int(b):
  print("A is greater than B")
elif int(a) == int(b):
  print("A is equal to B")
else:
  print("B is greater than A")
 
sign = input("Give me a symbol:")
if sign == "+":
  print(a, "plus", b, "is", int(a) + int(b))
else:
  print("I don't know this symbol", sign)

print("The program is exiting... bye")
Comments