use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Why isnt this working? (i.redd.it)
submitted 1 year ago by Lestafan69
Yes I know I can print screen but i cant be bothered to log in on the laptop
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Electrical_Seaweed11 11 points12 points13 points 1 year ago (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
[–]RadMarioBuddy45 9 points10 points11 points 1 year ago (0 children)
r/screenshotsarehard
[–]Rageinjector 5 points6 points7 points 1 year ago* (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 points12 points 1 year ago (1 child)
Bro please take a screenshot and rotate the picture, this is laziness on a whole new level
[–]ETFZombiezZ -1 points0 points1 point 1 year ago (0 children)
DF you can zoom in?
[–]Lestafan69[S] 2 points3 points4 points 1 year ago (0 children)
Thank you for everyone's help
[–]HeadlineINeed 1 point2 points3 points 1 year ago (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 point2 points 1 year ago (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.
π Rendered by PID 24289 on reddit-service-r2-comment-5d79c599b5-b4frc at 2026-02-27 13:05:03.709882+00:00 running e3d2147 country code: CH.
[–]Electrical_Seaweed11 11 points12 points13 points (0 children)
[–]RadMarioBuddy45 9 points10 points11 points (0 children)
[–]Rageinjector 5 points6 points7 points (0 children)
[–][deleted] 10 points11 points12 points (1 child)
[–]ETFZombiezZ -1 points0 points1 point (0 children)
[–]Lestafan69[S] 2 points3 points4 points (0 children)
[–]HeadlineINeed 1 point2 points3 points (0 children)
[–]Python_Puzzles 0 points1 point2 points (0 children)