osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to store scores of a race's players


Hello!

I need to store scores of three players for more than a race, after 
every race the user will read "Is the competition finished?", if the 
competition if finished the user will see the winner who got higest score:

p1 = int (input ("Insert score of the first player: "))
p2 = int (input ("Insert score of the second player: "))
p3 = int (input ("Insert score of the third player: "))

race = str (input ("Is the competition finished?"))

totalp1 = 0
totalp2 = 0
totalp3 = 0

winner = 0

if p1 > p2 and p1 > p3:
     winner = c1
elif p2 > p1 and p2 > p3:
     winner = p2
else:
     winner = p3

if "yes" in race:
     print("The winner is:",winner)
else:
     p1 = int (input ("Insert score of the first player: "))
     p2 = int (input ("Insert score of the second player: "))
     p3 = int (input ("Insert score of the third player: "))

race = str (input ("Is the competition finished?"))

You read above just my toughts, is there someone who could help me to 
understand how to solve it?

Regards.
^Bart