Skip to content

Instantly share code, notes, and snippets.

@archisman-panigrahi
Created February 27, 2020 17:28
Show Gist options
  • Save archisman-panigrahi/71381b05f8e9dbe11445162695241c38 to your computer and use it in GitHub Desktop.
Save archisman-panigrahi/71381b05f8e9dbe11445162695241c38 to your computer and use it in GitHub Desktop.
print("Press 1 to add two numbers, 2 to subtract, 3 to multiply, 4 to divide")
a = int(input())
#Note: Generally input is interpreted as a string.
#Therefore I am converting that to integer
if a == 1:
b = float(input("First number: "))
#Note:In the above line the input is converted to a float
c = float(input("Second number: "))
print("The sum is", b + c)
elif a == 2:
print("Only addition is implemented. Subtraction is left to be implemented by Tias")
elif a == 3:
print("Only addition is implemented. Multiplication is left to be implemented by Tias")
elif a == 4:
print("Only addition is implemented. Division is left to be implemented by Tias")
else:
print("Error. Input must be either 1,2,3,4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment