how to make a countdown in pygame

start_ticks=pygame.time.get_ticks() #starter tick
while mainloop: # mainloop
    seconds=(pygame.time.get_ticks()-start_ticks)/1000 #calculate how many seconds
    if seconds>10: # if more than 10 seconds close the game
        break
    print (seconds) #print how many seconds

Here is what the above code is Doing:
1. It’s creating a variable called start_ticks. This variable will store the number of ticks at the beginning of the program.
2. It’s creating a while loop that will run until the mainloop variable is set to False.
3. It’s calculating the number of seconds that have passed since the start of the program.
4. It’s printing the number of seconds that have passed.
5. If more than 10 seconds have passed, the program will break out of the while loop.