0

python, help

import random def tab(): rand=[random.randrange(1, 50, 1) for i in range(10)] return rand how to print this rand 5 time, maybe using for or while?

5th Nov 2018, 3:22 AM
Kasia Herasymenko
Kasia Herasymenko - avatar
3 odpowiedzi
+ 7
Do you want to print the same list 5 times? Then just add the following at the end of your code: rand_list = tab() for i in range(5): print(rand_list) But if you want 5 random lists: for i in range(5): print(tab())
5th Nov 2018, 3:26 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 2
You're welcome! 😊
5th Nov 2018, 3:34 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 1
Thanks so much
5th Nov 2018, 3:33 AM
Kasia Herasymenko
Kasia Herasymenko - avatar