Python World cup Sim Problem. If statements not working and need help adding the goals

Discussion in 'Support and Debugging' started by Unique Fuses, Jul 8, 2018 with 2 replies and 70 views.

Tags:
  1. Unique Fuses

    Unique Fuses Newbie

    Messages:
    23
    Ratings:
    1
    I'm trying to create a world cup simulator in python (since the world cup is underway).

    So far I have added a random function for the program to choose 2 random teams from an already set out list. This works fine but I will include in case the problem lies in this first def
    [​IMG]

    This second def is where the problem lies
    [​IMG]
    The problem is not making the minutes pop up on the screen as the program is able to do that already. The problem seems to be with the if statement in the while loop as when minutes reaches one of those numbers ending in 1, 2 or 3 (i.e: 61) Instead of printing "In the 61st minute..." it prints "In the 61th minute..." which is not what I want to happen. I can't seem to fix the problem. Any help is appreciated.

    ALREADY CODED NOW:
    Also if anyone is willing would you be able to help me create something so that if a team scores, it then saves to that team who scores so I can then output that at the end of the game. (i.e: If the program outputs "In the 75th minute Brazil HAVE SCORED!" it adds one goal to Brazil and not just the total goals)

     
    Last edited: Jul 8, 2018
  2. OP
    Unique Fuses

    Unique Fuses Newbie

    Messages:
    23
    Ratings:
    1
    UPDATE:
    I have managed to get a goals function working and for it to be successfully outputted. The minutes problem is still not fixed
     
  3. OP
    Unique Fuses

    Unique Fuses Newbie

    Messages:
    23
    Ratings:
    1
    UPDATE:
    I've changed the minutes but now instead of just printing "in the ...st minute..." for numbers ending in 1, now every minute ends in st so now I have "In the 57st minute..." which is not what i want either
    [​IMG][​IMG]