A shorter version of the calculator
Hi, After learning functions with arguments, I have made a smaller version of this calculator... Would like to post here, maybe someone finds this helpful. This calculator have only two options to select... Calculate or Quit. It also takes only calculation symbols rather than typing the add, subtract etc. I know it's not a hot shot ;) but it's just a try of a newbie. Hope good suggestions would come for me as well. =============================== def calc(num1, num2, symb): if symb == "+": answer = str(num1+num2) print("The Answer is " + answer) elif symb == "-": answer = str(num1-num2) print("The Answer is " + answer) elif symb == "*": answer = str(num1*num2) print("The Answer is " + answer) elif symb == "/": answer = str(num1/num2) print("The Answer is " + answer) while True: print("Options:") print("Enter '1' to Calculate numbers") print("Enter '0' to Quit") user_input = input(": ") if user_input == "0": break else: num1 = float(input("Enter First Number...:")) symbol = input("Enter Symbol..") num2 = float(input("Enter Scond Number...:")) calc(num1, num2, symbol) ================================