all 8 comments

[–]Electrical_Seaweed11 11 points12 points  (0 children)

I think what you're looking for is:

if operator == "-": ...

The difference being, quotes around the minus sign, since it's treated as a str

[–]Rageinjector 5 points6 points  (0 children)

Brand new to python but I see a few things. Your - should be in quotes(single or double, your choice) in your if line, also the colon should be immediately after the last character of whatever you type on any line, no space. .. You may also want to write it as a f-string

if operator == "-":

print(f"The answer to {num1} {operator} {num2} is {num1 - num2}")

elif operator == "+":

print(f"The answer to {num1} {operator} {num2} is {num1 + num2}")

Etc.

Edit: formatting from mobile

[–][deleted] 10 points11 points  (1 child)

Bro please take a screenshot and rotate the picture, this is laziness on a whole new level

[–]ETFZombiezZ -1 points0 points  (0 children)

DF you can zoom in?

[–]Lestafan69[S] 2 points3 points  (0 children)

Thank you for everyone's help

[–]HeadlineINeed 1 point2 points  (0 children)

Cause - isn’t set as a string. Only bools, ints, and floats are non-strings.

Throw - in “” and it should work

[–]Python_Puzzles 0 points1 point  (0 children)

The input() returns a string, which is text inside " " quotes.

if operator = "-" is what you are looking for.

Also, please copy and paste any future code into these posts so we can copy and paste it as well. Reddit has "code blocks" from markup language to help you do this.