chrome dino game jumping twice per click in pygame

hello i am currently trying to make a jumping game in pygame a lot like the chrome dino game. i have made some simple code to draw a square and make it jump. i will my code dow n bellow. my problem is with the jumping part. whenever i press w wichis the the jump button the square jumps multiple times(usauly 2 times). good people of stack overflow please help a man in need.
here is my code

import pygame

pygame.init()

screen_width = 500
screen_height = 400
isJump = False
y = 350
x = 50
BLUE=(0,0,255)
run = True

screen = pygame.display.set_mode((screen_width, screen_height))
screen.fill((0,0,0))
pygame.display.set_caption("syoma n9ot intelent")
pygame.draw.rect(screen,BLUE,(x,y,50,50))

while run:
  pygame.display.flip()
  for event in pygame.event.get():
      keys = pygame.key.get_pressed()
      if keys(pygame.K_w):
        for a in range (1,250): 
          y -= .5
          screen.fill((0,0,0))
          pygame.draw.rect(screen,BLUE,(x,y,50,50))
          pygame.display.flip()

          
        for a in range (1,250):
          y += .5
          screen.fill((0,0,0))
          pygame.draw.rect(screen,BLUE,(x,y,50,50))
          pygame.display.flip()


          
        
        
 
      if event.type == pygame.QUIT:
       run = False
pygame.quit()