# Creating a Simple Calculator with Python

Today, I learned how to build a basic calculator using Python. It was a great hands-on experience that helped me understand how to handle user input, perform arithmetic operations, and structure my code more clearly. It may be a small step, but it’s definitely a solid one in my Python journey!

here is the snippet

#simple calculator

num1 = float(input("Enter the first number: "))

num2 = float(input("Enter the second number: "))

print("operations")

print("1:addition")

print("2:subtraction")

print("3:multiplication")

print("4:division")

operation = input("choose an operation: ")

if (operation == "1"):

result = num1 + num2

print(result)

elif (operation == "2"):

result = num1 - num2

print(result)

elif (operation == "3"):

result = num1 \* num2

print(result)

elif (operation == "4"):

result = num1 / num2

if (num2 != 0):

print(result)

else:

print("error:number is zero")

else: print("invalid numbers")
