r/PythonLearning • • 24d ago

Help Request Else statement not working

Post image

Hello, my else statement is not working- the if statement its inside is, did i mess up the indents again or is it something else?

also would a display flip work to change the image back to the other image in the else statement?
any help is nice!

26 Upvotes

12 comments sorted by

View all comments

17

u/gitChara 24d ago

you wrote "img - pygame.image.load("ragebait.png")" with a " - ", instead of a " = ".
It should be "img = pygame.image.load("ragebait.png")"

2

u/TheCarFamily 24d ago

oh your kidding i was that dumb? thanks!

1

u/a_cute_tarantula 24d ago

Install pyright extension for vscode. It should come with the standard python extension pack. You should have error highlighting automatically for this kind of stuff

1

u/Most_Strike_93 23d ago

I would recommend ty now, and with ruff to format and lint