My assignment is to write a golf program that tallies the scores and prints out names and final scores in this format: Player4:21, Player2:33 etc etc. My question is can you use the range function to assign input to the proper variable name in Python 2.7. Here's what I have so far.
def players ():
playerQty = 0
playerQty = input ("How many players are playing? ")
if playerQty > 4:
print ("Too many players, please enter a smaller number.")
playerQty = input ("How many players are playing? ")
for x in range (playerQty):
players = raw_input("What is player's name? ")
def scores():
accum = 0
for x in range(19):
print ("You are on hole", x+1)
for x in range(playerQty):
scores = input ("What was your score for this hole?")
I want to assign their names to different variable name per player, but with the quantity of players being a variable, it's proving to be difficult. Once I can achieve that I can assign scores to specific players, turn them into a list, sort them, then get the proper output. Any, and all, help would be greatly appreciated.