Lesson 4: Control flow

Post date: Nov 16, 2018 4:00:58 PM

print("Control flow")

a = int(input("Give me a number:"))

if a < 10:

print("The number is smaller then 10")

print("This is block 1")

elif a == 10:

print("The number is 10")

print("This is block 2")

else:

print("The number is greater then 10")

print("This is block 3")

print ("This is the main flow")

b = int(input("Give me a second number:"))

op = input("Give me an operation:")

if op == "+":

print(a, "+", b, "=", a+b)

elif op == "-":

print(a, "-", b, "=", a-b)

elif op == "*":

print(a, "*", b, "=", a*b)

elif op == "/":

print(a, "/", b, "=", a/b)