目前球員只有一回合,而且從未顯示比賽的勝者。這個主要功能需要做些什麼變化才能讓每個玩家正好三回合?需要對主要功能進行哪些更改才能讓每個玩家恰好有三個回合?
def main():
display_welcome() #1
number_of_turns = 3
score_player1 = 0
score_player2 = 0
name_player1 = "Olivia"
name_player2 = "Ned"
turn_num = 1
first_player_num = random.randrange(1, number_of_turns + 1)
if first_player_num == 2:
temp = name_player1
name_player1 = name_player2
name_player2 = temp
score1 = have_one_turn(turn_num, name_player1)
score2 = have_one_turn(turn_num, name_player2)
score_player1 = score_player1 + score1
score_player2 = score_player2 + score2
if turn_num < number_of_turns:
display_turn_results(name_player1, score_player1, name_player2, score_player2, False) #10
else:
display_turn_results(name_player1, score_player1, name_player2, score_player2, True)
'對於i:'? – Julien
不能使用for..in循環 – BEMDAS
歡迎使用堆棧溢出。這不是讓某人爲你做作業的地方。你應該首先表現出努力。請描述你到目前爲止所嘗試的內容,以及你對這個問題的理解。例如,你能告訴我們給定的代碼當前的行爲不正確嗎? –