print(''' ======================================= | | | | | Main Menu | | | | | ======================================= ''') # Lists collecting user input data win_list = [] lose_list = [] score_list = [] opponent_list = [] # Here is the menu prompting the user to select the desired option to input. user_input = True while user_input: print(''' A.) Enter game results B.) Current Record C.) Display All results from games Won D.) Display All results from Opponent E.) Quit ''' ) # Below the code is asking for user input to collect data to be collected by the lists. user_input = input('Please select an option from the Menu.').upper() if user_input == "A": score_input = float(input("Please enter your score")) score_list.append(score_input) opponent_input = float(input("Please enter the opponents score")) opponent_list.append(opponent_input) high = max(score_list) low = min(score_list) result_input = input(''' Please enter the game result. A.) Win B.) Lose ''').upper() if result_input == "A": result_input = 1 win_list.append(result_input) elif result_input == "B": result_input = 1 lose_list.append(result_input) # The lists are being used here for mathematical purposes for the high,low and average data from the users game. elif user_input == "B": avg_score = sum(score_list) / len(score_list) avg_opponent_score = sum(opponent_list) / len(opponent_list) print("Highest Game Score Entered:", '%.2f score' % (max(score_list))) print("Lowest Game score entered:", '%d score' % (min(score_list))) print("Average Game score entered:", '%.2f score' % avg_score) print("Highest Opponent Game Score Entered:", '%.2f score' % (max(opponent_list))) print("Lowest Opponent Game score entered:", '%d score' % (min(opponent_list))) print("Average Opponent Game score entered:", '%.2f score' % avg_opponent_score) # User's data is displayed for the amount of wins/loses and the scores of those games if user_input == "C": print("You have Won", sum(win_list), "times and won with this score", score_list) elif user_input == "D": print("You're Opponent has Won", sum(lose_list), "times and won with this score", opponent_list) # Input to terminate loop elif user_input == "E": print("Good Bye") # If the input does not match the prompted selection this will scream at the user saying they have selected an # invalid option. elif user_input != "": print("Input not recognized please try again")
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)