I Have a query about a nested for loop result.
Code
dieCount = [0,0,0,0,0,0,0,0,0,0,0]
Die1 = random.randint(1,10)
dieCount[Die1] = dieCount[Die1] + 1
Die2 = random.randint(1,10)
dieCount[Die2] = dieCount[Die2] + 1
Die3 = random.randint(1,10)
dieCount[Die3] = dieCount[Die3] + 1
print ("Dice Roll Stats:")
index = 1
print ("\nFace Frequency")
while index < (len(dieCount)):
print (index)
for number in range(dieCount[index]):
print ("*")
index = index + 1
Result:
Face Frequency
1
2
3
4
*
5
6
*
7
8
9
*
10
For the life of me i cant figure out how to get a result like such:
Face Frequency
1
2
3
4*
5
6*
7
8
9*
10
If not an answer please guide me to the rite material so I may read through it, I have attempted many different alteration of the code but I still haven't com-up with a decent result. I can use print ("*",end='') but that will append the * before the number. Like wise I tried something like print (index,"*") and then del dieCount[Die1] etc.. to remove the duplicate numbers however that will remove the number completely out of the list.