lundi 21 septembre 2020

how to print list elements with square brackets in a list - Python I

I'm new to Python, I'm trying to print an empty list with random int numbers through while loop but I'm not getting the square brackets in the output, here's my code:

import random
randlist=[]
i=0
while i in range(0,5):
    c=random.randint(1,100)
    randlist.append(c)
    print(c,end=", ")
    i=i+1
print("")
print("Minimum value:\t",min(randlist))
print("Maximum value:\t",max(randlist))

the output looks like this:

12,31,43,58,63,
Minimum value= 12
Maximum value 63



Aucun commentaire:

Enregistrer un commentaire