I've been trying to get pygame to detect keypresses so later on I can move a character around on the screen. I'm new to coding so I might just be missing something simple, but I can't figure out what's wrong with the code, should I switch to pygame.key.get_pressed() or something instead? thanks in advance.
running = True
while running: 
    screen.fill((0,0,0))
    # set background
    screen.blit(background, (0,0))
    player(playerX, playerY)
    pygame.display.update()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        
# detecting key presses
    if event.type == pygame.KEYDOWN:
        if event.type == pygame.K_LEFT:
            print("left")
        if event.type == pygame.K_RIGHT:
            print("right")
        if event.type == pygame.K_UP:
            print("up")
    if event.type == pygame.KEYUP:
        if event.type == pygame.K_LEFT or event.type == pygame.K_RIGHT:
            print("stop")
        pygame.display.update()
 
     
    