Python - Calculator

In Python, one of the first exercises people do is make a calculator using arithmetic. It's very good for allowing beginners to understand how code works, along with debugging skills. A basic one may go like this:


      print("Calculator!")
      operation = input("Choose an operation: ")
      num1 = int(input("Choose a number: "))
      num2 = int(input("Choose a second number: "))
      
      if operation == "+":
          result = num1 + num2
      elif operation == "-":
          result = num1 - num2
      elif operation == "*":
          result = num1 * num2
      elif operation == "/":
          if num2 == 0:
              print("Cannot divide by 0!")
          else:
              result = num1 / num2
      
      print("Result:", result)