Hi, little issue. Could u please tell me how to remove the {} between each number and "0" in the output of the console ? Thanks!
1 2 3 4 5 6 7 8 9 10 11 12 13 |
def fonction2_bis(n,a,b): import random r = random.randint(a,b) L = [] L2 = [] for i in range (n): r = random.randint(a,b) L.append(r) for item in L: dict = { str (item): "\"" + str ( 0 ) + "\"" } L2.append( dict ) print ( "There are" ,( len (L)), "items" ) return L2 |
1 2 3 |
>>> fonction2_bis( 5 , 1 , 2 ) There are 5 items [{ '2' : '"0"' }, { '2' : '"0"' }, { '2' : '"0"' }, { '2' : '"0"' }, { '1' : '"0"' }] |
