mercredi 3 mars 2021

print a random number * n times (all different numbers) [duplicate]

so I want an output like this 5, 7, 23, 15, 6, 3 all random in one line Matrix

I know I could do

from random import randrange
for i in range(5):
    print(f' {randrange(50)}')

the problem with this they will not be in one line.

so I tried this print(f' {randrange(100)}' * 5) but the output show similar numbers like this 27, 27, 27, 27, 27

any solution?




Aucun commentaire:

Enregistrer un commentaire