weird behaviour of 6,7,8,9 keys in pycharm program

I just created a simple pycharm program but is showing different results that it is supposed to show.

when i gave johnny_record a value of 6,7,8 or 9 instead of opening a pygame window. it simply prints "Hey"

import sys
import pygame
johnny_record = input("What is johnny's record?")
johnny_record = str(johnny_record)
def sex():
while johnny_record < str(50):
pygame.init()
pygame.display.set_mode((600, 600))
pygame.display.set_caption("Johnny")
pygame.display.flip()
screen_events = pygame.event.get()
for events in screen_events:
if events.type == pygame.KEYDOWN:
if events.key == pygame.K_7:
print("Hey, you pressed 7 key!")
if events.key == pygame.K_0:
sys.exit()


if __name__ == '__main__':
sex()
print("Hey")

Please sign in to leave a comment.