You will read an existing .csv file, and display a bar chart or…
Question Answered step-by-step You will read an existing .csv file, and display a bar chart or… You will read an existing .csv file, and display a bar chart or histogram of the name of the player and the number of tries for each game. My original code is :from random import randrangeimport csvchoice =’y’players = {}try: csv_file = open(“game_history.csv”, ‘r’) csv_reader = csv.reader(csv_file, delimiter=’,’) for line in csv_reader: players[line[0]] = int(line[1]) csf_file.close()except: passif len(players) > 0: print(“Game History:”) for player in players: print(player+” : “+str(players[player]))while choice == ‘y’: randNumber = randrange(1,10) name = input(“Enter Your Name:”) attempts = 0 while True: attempts += 1 guess = int(input(“Guess the number.”)) if guess == randNumber: if name in players: players[name] += 1 print(name) else: players[name] = 1 print(“attempts took : “,attempts); print(“Guess is Correct”) break elif guess > randNumber: print(“Guess was to high”) elif guess < randNumber: print("Guess was too low") choice = input("Do you want to continue[y/n]: ")best_player_score = None The result needs to look like this:I need to add in the bar graph automatically and have it updated with the information from when the game is played. Image transcription textRandy 5 P K L M N C E F G H Randy Marc 5 2 Lowest scorn "as 3 John Paul Game scores 10 11 12 13 1416 GAMES 17 18 19 21 10 11 12 22 1 4 M... Show more Computer Science Engineering & Technology Python Programming Share QuestionEmailCopy link Comments (0)


