On Mar 26, 2019 6:55 AM, "^Bart" <gabriele1nos...@hotmail.com> wrote:
>
> 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:
>
Thank you for reaching out to us for help as You Learn Python. A good
mailing list to use instead of the main python list is tu...@python.org.
I'm including that list in the reply addresses; please use that address in
the future and always reply all so a copy goes to that list.

This looks like a homework assignment. Be advised we won't write code for
you but we will help you when you get stuck and provide some guidance. I'm
personally curious as to who wrote that specification, since it is not well
written. One of the questions that fails to address is what if two or more
players have the same high score?

It's also a little hard to guide you since we don't know what you've
already learned. One of the fundamental concepts in computer programming is
that of a loop. Since the requirements indicate there will be more than one
race that requires a loop. The simplest python construction for a loop is a
while. Within that Loop you write the code once rather than rewriting it as
you have done. I hope that is enough to get you started. Please apply that
advice as best you can and come back with a revised program.

> 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
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to