Skip to content

Commit 6bdfd24

Browse files
Update 22-Calculator.py
1 parent 0af97b1 commit 6bdfd24

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

22-Calculator.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11

22
def calc(x, y, ops):
3-
"""
4-
Returns a string like this: a op b = c
5-
where c is the computed value according to the opeartor
6-
"""
73

84
if ops not in '+-/*':
9-
return 'Please only type one of these characters: "+, -, *, /"!'
5+
return 'Choose operator: "+, -, *, /"!'
106

117
if ops == '+':
128
return(str(x) + ' ' + ops + ' ' + str(y) + ' = ' + str(x + y))
@@ -19,8 +15,8 @@ def calc(x, y, ops):
1915

2016
while True:
2117

22-
x = int(input('Please type the first number: '))
23-
y = int(input('Please type the second number: '))
18+
x = int(input('Enter first number: '))
19+
y = int(input('Enter second number: '))
2420
ops = input("Choose between +, -, *, / ")
2521

2622
print(calc(x, y, ops))

0 commit comments

Comments
 (0)