I am having trouble with sorting this array to get the highest total amount of points and with the name next to it.
For entering the events its:
Flag = True
while Flag:
try:
e = str(input("Enter Event names [Type XXX to stop]: "))
if e == 'XXX':
Flag = False
else:
event.append(e)
except ValueError:
print("Please enter a word, Thanks")
print()
For entering house names its:
Flag = True
while Flag:
try:
h = str(input("Eneter House names [Type XXX to stop]: "))
if h == 'XXX':
Flag = False
else:
total = total + 1
house.append(h)
except ValueError:
print("Please enter a word, Thanks")
print()
For then getting the points for events and house as follows:
for i in (event):
for j in (house):
Flag = True
while Flag:
try:
sevent = int(input("Enter %s's house for %s score: "%(j, i)))
if sevent < 0:
print("Enter a number above 0, Thanks")
else:
Flag = False
except ValueError:
print("Please enter a number above, Thanks")
if j not in scores:
scores[j] = []
scores[j].append(sevent)
score.append(sevent)
s_house = (j), (sevent)
s_house_event.append(s_house)
Flag = True
s_h_and_e = (i), (s_house_event)
list1.append(s_h_and_e)
As an example for when the output of the program as follows:
{'House 3': [2, 3, 4], 'House 2': [7, 7, 5], 'House1': [4, 4, 2]}
I am having trouble getting the House with the highest total sum of the points and printing an overall winner.
Thanks for anyone who can help.