dimanche 3 juin 2018

How to properly use sleep with print and random in python

I’m a novice and I have been trying to build a random countdown timer which picks a number between 0 and 10, and counts to zero from the selected integer. All while printing the countdown simultaneously. However, I keep getting errors from sleep().

import random
import time

x = random.randint(0,10)

y = time.sleep(x)

while y != 0:
    print(y)




Aucun commentaire:

Enregistrer un commentaire