lundi 11 novembre 2019

How do I generate a specific amount of random numbers?

I have to ask the user for a number and then produce exactly as many random numbers as specified by the user using a while loop.

import random

x = int(input("Write a number: "))
y = random.randint(0, 10)

while x != 0:
    print(y)
    y = random.randint(0, 10)



Aucun commentaire:

Enregistrer un commentaire