A Million Errors

A website about how not to ask for programming help.

View on GitHub

HELP!!!! MY CODE HAS AN ERROR IN IT! MY HOMEWORK ASSIGNMENT IS DUE IN AN HOUR! I NEED HELP!!!

Does this sound familiar? Maybe you were the one panicking. Maybe you were the one reading this sentence and thinking "why'd you wait until the last minute to do your homework?"

What I think when I see this is "what is the error?"

I often answer programming questions that I come across in online forums or discord servers. It's also often painfully clear when someone doesn't take the time to describe the problem they actually have. When you say "error", what exactly do you mean? I often use the saying

There are a million ways something can "not work". Every single one of those is a different problem with a different solution. I can't possibly know what's wrong without you describing what the problem actually is.
To show you what I mean, let me emulate what a help request I'm trying to discourage might look like:
My player isn't moving right or down. When I press down, it goes up. When it gets to the edge of the screen, it doesn't move past it. When I move, the old one still shows up. Help me! I don't know what I'm doing and ChatGPT said that I need to fill the screen, but when I do that I don't see anything anymore. Help me!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pygame

screen = pygame.display.set_mode((500, 500))

player = pygame.Rect(250, 250, 30, 30)
player_speed = 0.5 # bcuz it goes fast, make this smol

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    keys = pygame.key.get_pressed()
    if keys[pygame.K_RIGHT]: # right arrow means go right
        player.x += player_speed
    if keys[pygame.K_LEFT]: # left arrow means go left
        player.x -= player_speed
    if keys[pygame.K_UP]: # up arrow means go up
        player.y += player_speed
    if keys[pygame.K_DOWN]: # down arrow means go down
        player.y -= player_speed

    pygame.draw.rect(screen, "red", player)
    pygame.display.update()