Please help me with the task: Simple Calculator.

Hello, I’m working on this task:

Here is my code:


def add(a: int, b: int) -> int:
   """Returns the sum of two integers."""
   return a + b

def subtract(a: int, b: int) -> int:
   """Returns the difference between two integers."""
   return a - b

def multiply(a: int, b: int) -> int:
   """Returns the product of two integers."""
   return a * b

def divide(a: int, b: int) -> float:
   """Returns the result of dividing the first integer by the second (as a float)."""
   if b != 0:
       return a / b
   else:
       return float('inf')  # Handle division by zero

def main():
   try:
       command = input("Enter a command ('add', 'subtract', 'multiply', or 'divide'): ")
       num1 = int(input("Enter the first integer: "))
       num2 = int(input("Enter the second integer: "))
   except ValueError:
       print("Invalid input. Please enter valid integers.")
       return

   result = None  # Initialize result with a default value

   if command == "add":
       result = add(num1, num2)
   elif command == "subtract":
       result = subtract(num1, num2)
   elif command == "multiply":
       result = multiply(num1, num2)
   elif command == "divide":
       result = divide(num1, num2)
   else:
       print("Invalid command. Please enter 'add', 'subtract', 'multiply', or 'divide'.")

   if result is not None:
       print(f"Result: {result}")

if __name__ == "__main__":
   main()


Can anyone please help me to solve it?