Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
707cd4e5ea |
38
main.py
Normal file
38
main.py
Normal file
@ -0,0 +1,38 @@
|
||||
def main():
|
||||
print("Welcome to the Simple Math Calculator!")
|
||||
print("Please choose an operation: +, -, *, /")
|
||||
|
||||
# Get operation from the user
|
||||
operation = input("Enter operation: ")
|
||||
|
||||
# Get two numbers from the user
|
||||
try:
|
||||
num1 = float(input("Enter the first number: "))
|
||||
num2 = float(input("Enter the second number: "))
|
||||
except ValueError:
|
||||
print("Invalid input! Please enter numeric values.")
|
||||
return
|
||||
|
||||
# Perform the selected operation
|
||||
if operation == '+':
|
||||
result = num1 + num2
|
||||
elif operation == '-':
|
||||
result = num1 - num2
|
||||
elif operation == '*':
|
||||
result = num1 * num2
|
||||
elif operation == '/':
|
||||
if num2 == 0:
|
||||
print("Error: Division by zero is not allowed!")
|
||||
return
|
||||
result = num1 / num2
|
||||
else:
|
||||
print("Invalid operation! Please choose +, -, *, or /.")
|
||||
return
|
||||
|
||||
# Display the result
|
||||
print(f"The result of {num1} {operation} {num2} is: {result}")
|
||||
|
||||
# Call the main function
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
functions-framework==1.4.3
|
||||
markupsafe==2.0.1
|
||||
Loading…
Reference in New Issue
Block a user