Skip to content

Commit 1bc5fdd

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 7d46ab2 commit 1bc5fdd

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

scripts/simple_calculator.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
def add(a, b):
22
return a + b
33

4+
45
def subtract(a, b):
56
return a - b
67

8+
79
def multiply(a, b):
810
return a * b
911

12+
1013
def divide(a, b):
1114
if b == 0:
1215
return "Error: Division by zero"
1316
return a / b
1417

18+
1519
if __name__ == "__main__":
1620
print("Simple Calculator")
1721
x = float(input("Enter first number: "))
1822
y = float(input("Enter second number: "))
1923
op = input("Enter operation (+, -, *, /): ")
2024

21-
if op == '+':
25+
if op == "+":
2226
print("Result:", add(x, y))
23-
elif op == '-':
27+
elif op == "-":
2428
print("Result:", subtract(x, y))
25-
elif op == '*':
29+
elif op == "*":
2630
print("Result:", multiply(x, y))
27-
elif op == '/':
31+
elif op == "/":
2832
print("Result:", divide(x, y))
2933
else:
3034
print("Invalid operation!")
31-
32-
33-

0 commit comments

Comments
 (0)