I am not 100% sure that I am using the random.seed correctly for this assignment, or if there is a more efficient way to write the code. Any feedback is appreciated.
Assignment Description: Simulate rolling 2 die one hundred times. Keep track of the total of the two die. Print a histogram in which the total number of times the dice rolls equals each possible value is displayed by printing a character, such as *, that number of times
import random
random.seed(2)
# declaring an array to count the occurrences
a= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
# looping for 100 times and saving the count in array
for i in range(100):
x = random.randint(1,6)
y = random.randint(1,6)
a[x+y] = a[x+y] + 1
# printing histogram
for i in range(2, 13):
print(str(i).rjust(2)+"s: ","*"*a[i])