vendredi 19 février 2021

random number of " * " in a row in python 3

I want to generate a random number of " * " smaller than 21 and larger than 0 in a row for 100 times, in python

I tried to write:

import random 
for x in range(100): 
    a = random.randint(1, 20) 
    for y in a: 
        print("*")

Can someone help me? I am beginner in programming




Aucun commentaire:

Enregistrer un commentaire