Last active
March 29, 2020 00:24
-
-
Save scott-lydon/74ece728bfe362020b32bd913ce370b7 to your computer and use it in GitHub Desktop.
Python
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
first = float(input("first number")) | |
operand = input("Your operand (accepting addition, multiplication, division, subtraction)") | |
second = float(input("second number")) | |
if operand == "x" or operand == "multiplication" or operand == "multiply" or operand == "*": | |
print(first * second) | |
elif operand == "+" or operand == "addition" or operand == "add": | |
print(first + second) | |
elif operand == "-" or operand == "subtraction" or operand == "subtract": | |
print(first - second) | |
elif operand == "/" or operand == "division" or operand == "divide": | |
print(first / second) | |
count = [1, 3, 4] | |
count += 3, 4, 5 | |
print(count) | |
''' | |
(base) scottlydon@Scotts-MacBook-Air python % Python calculator.py | |
first number39 | |
Your operand (accepting addition, multiplication, division, subtraction)addition | |
Traceback (most recent call last): | |
File "calculator.py", line 2, in <module> | |
operand = input("Your operand (accepting addition, multiplication, division, subtraction)") | |
File "<string>", line 1, in <module> | |
NameError: name 'addition' is not defined | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know that "addition" is not defined. It is a user inputted value.