Created
February 27, 2020 17:28
-
-
Save archisman-panigrahi/71381b05f8e9dbe11445162695241c38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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