#write a program that play dice game #this program demonstrates how to use list to store counters and avoid using #long if/elif/else statement #we will assume that the input is VALID import random def diceGame(num_games): counter = [0]*7 print("random numbers are ") for i in range(num_games): n = random.randint(1, 6) print("game #", i+1, "random number is ", n) counter[n] = counter[n] + 1 return counter def main(): num_games = int(input("enter number of games to play ")) #input is valid so we are not checking validity here counter = diceGame(num_games) print("printing how many times each number appears in the dice game ") for i in range(1, 7): print(i, counter[i]) main()