Compare commits
No commits in common. "v3" and "main" have entirely different histories.
38
main.py
38
main.py
@ -1,38 +0,0 @@
|
|||||||
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()
|
|
||||||
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
functions-framework==1.4.3
|
|
||||||
markupsafe==2.0.1
|
|
||||||
Loading…
Reference in New Issue
Block a user