Khaled bashtr bashtr

num1=float(input("please enter the first number: "))
operator=input("please enter the operator: ")
nam2=float(input("please enter the second number: "))

if operator == “+”;
print(num1 + num2)
elif operator == “-”;
print(num1 _ num2)
elif operator == “/”;
print(num1 / num2)
elif operator == “×”;
print(num1 × num2)
else:
print(“wrong operator please try again”)

Although this thread has nothing to do with “typing”, my guess is that you’re looking for a corrected version of your code?

num1 = float(input("please enter the first number: "))
operator = input("please enter the operator: ")
num2 = float(input("please enter the second number: "))

if operator == "+":
    print(num1 + num2)
elif operator == "-":
    print(num1 - num2)
elif operator == "/":
    print(num1 / num2)
elif operator == "x":
    print(num1 * num2)
else:
    print("wrong operator please try again")

It’s a very basic script, but if it serves to get you started, then it should serve that purpose, least ways.

To add: as a follow-up, this is the kind of thing that works the same way, but is much more concise:

import operator
opp = {
    "+": operator.add,
    "-": operator.sub,
    "/": operator.truediv,
    "x": operator.mul
}

num1 = float(input("please enter the first number: "))
operator = input("please enter the operator: ")
num2 = float(input("please enter the second number: "))

if operator in opp:
    print(opp[operator](num1, num2))
else:
    print("wrong operator please try again")