Description : Lab 3 – Flow Control
Code:
def SumNumber(x, y): Sum = x + y print(Sum) def SubNumber(x, y): Sub = x - y print(Sub) def MultNumber(x, y): Mult = x * y print(Mult) def DevNumber(x, y): Dev = x / y print(Dev) def RemainNumber(x, y): Remain = x % y print(Remain) def CompNumber(x, y): if x > y: print(x, "is greater than", y) elif x 0: print ("1- Sum numbers") print ("2- Subtract numbers") print ("3- Multiply numbers") print ("4- Divide numbers") print ("5- Remainder of numbers") print ("6- Compare numbers") print ("7- Exit") Option = int (input("Please choose an option ")) if Option == 7: print ("Finished") i = (0) elif Option == 1: a = int (input("Please input a number ")) b = int (input("Please input a number ")) SumNumber(a, b) elif Option == 2: a = int (input("Please input a number ")) b = int (input("Please input a number ")) SubNumber(a, b) elif Option == 3: a = int (input("Please input a number ")) b = int (input("Please input a number ")) MultNumber(a, b) elif Option == 4: a = int (input("Please input a number ")) b = int (input("Please input a number ")) DevNumber(a, b) elif Option == 5: a = int (input("Please input a number ")) b = int (input("Please input a number ")) RemainNumber(a, b) elif Option == 6: a = int (input("Please input a number ")) b = int (input("Please input a number ")) CompNumber(a, b)
Screenshot