Challenge: Program Usage at the Command Prompt as a Utility

Write a program that can be used at the command prompt as a calculating utility.

Write a program that can be used at the command prompt as a calculating utility. The usage of the program is shown below:

python3 calc.py <switch> <n> <m>

In the code snippet above, n and m are two integer operands. The switch can be any arithmetic operator. The output should be the result of the operation:

  • Input: Any arithmetic operator switch and two integers—n and m.
  • Output: The output will be the result of the operation applied to the integers n and m.

Get hands-on with 1200+ tech skills courses.