Today i made a small space invaders game in visual studio code

I made it so that you can move the ship left and right using if keys[pygame.K_LEFT] and player.x > 0:
player.x -= 5
if keys[pygame.K_RIGHT] and player.x < w – 40:
player.x += 5
which allowed it to move left and right.