in other words, if a player has 37 #six items in their list, you may assume they have won. 34 35 You may assume we will never use an invalid piece name, 36 Wduplicate pieces, etc. You may assume that only one player will have 33 wall six pieces. 26 # 27 check_winner((winning player, losing player_a, losing player_b)) -> "Player 1 wins!" 28 check winner (losing player a, losing player b, losing player_c)) -> "Keep playing! 29 check winner((losing player losing player_c, winning player)) -> "Player 3 wins!" 30 # 31 Remember, the function should RETURN these strings, not 32 Wprint them. losing_player_c - i "Yellow", "Purple", "Green", "Blue") 24 → 25 Then. 15 16 WIf no player has all 6 pieces, check_winner should return 17 #the string, "Keep playing!" 18 19 For example, if these were four possible players: 20winning player - ("Red", "Orange "Yellow", "Purple", "Green", "Blue" 1 21 # losing_player_a 1 22. For this 13 #problem, the first player in the list should be called 14 Player i, the second player Player 2, and so on. 10 #rf any player has all 6 pieces, check winner should return 11 the string, "Player x wins!" where X refers to the position 12 #of the player in the list who has all 6 pieces. 7 WEach list will represent one player's current progress 8 #toward gathering six pieces. This function will 6 take as input a tuple with at least 2 lists, but up to 6. 4# 5 wwrite a function called check winner. 3 The first player to collect all six wins. 9 1 In the board game Trivial Pursuit, players try to collect 2 #six pieces: Yellow, Green, Red, Blue, Purple, and Orange.
0 Comments
Leave a Reply. |