-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 15dc42e
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM python:3.9-slim | ||
|
||
WORKDIR /app | ||
COPY . /app | ||
|
||
CMD ["python", "app.py"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
def add(a, b): | ||
return a + b | ||
|
||
def subtract(a, b): | ||
return a - b | ||
|
||
def multiply(a, b): | ||
return a * b | ||
|
||
def divide(a, b): | ||
if b != 0: | ||
return a / b | ||
else: | ||
return "Division by zero error" | ||
|
||
def main(): | ||
print("Simple Python Calculator") | ||
a = float(input("Enter first number: ")) | ||
b = float(input("Enter second number: ")) | ||
operation = input("Enter operation (+, -, *, /): ") | ||
|
||
if operation == '+': | ||
print(f"Result: {add(a, b)}") | ||
elif operation == '-': | ||
print(f"Result: {subtract(a, b)}") | ||
elif operation == '*': | ||
print(f"Result: {multiply(a, b)}") | ||
elif operation == '/': | ||
print(f"Result: {divide(a, b)}") | ||
else: | ||
print("Invalid operation") | ||
|
||
if __name__ == "__main__": | ||
main() |