Netbyzz

#B014

Python :

#CODE = #B014
# Basic Calculator
print("Welcome to the basic calculator!")
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))

# Perform arithmetic operations
print("Choose an operation: +, -, *, /")
operation = input()

if operation == "+":
    result = num1 + num2
    print(f"The result of {num1} + {num2} is {result}")
elif operation == "-":
    result = num1 - num2
    print(f"The result of {num1} - {num2} is {result}")
elif operation == "*":
    result = num1 * num2
    print(f"The result of {num1} * {num2} is {result}")
elif operation == "/":
    if num2 != 0:
        result = num1 / num2
        print(f"The result of {num1} / {num2} is {result}")
    else:
        print("Error: Division by zero is not allowed!")
else:
    print("Invalid operation!")

input()

Source Code