我正在編寫一個程序,允許用戶輸入甚至是數字,然後它會生成一個循環賽比賽時間表。 n/2 * n-1
遊戲數量,以便每個玩家玩其他玩家。循環賽比賽的python程序
現在我很難生成用戶輸入的玩家數量列表。我得到這個錯誤:
TypeError: 'int' object not iterable.
我得到這個錯誤很多我的計劃,所以我想我不是很瞭解Python中的一部分,所以如果有人能解釋一下爲好,我想欣賞它。
def rounds(players, player_list):
"""determines how many rounds and who plays who in each round"""
num_games = int((players/2) * (players-1))
num_rounds = int(players/2)
player_list = list(players)
return player_list
你打電話給'rounds'? – Blender 2013-03-12 03:58:16
你打算用'list(players)'做什麼? – pradyunsg 2013-03-12 03:59:24
有多少遊戲可以在同一時間進行,因此n/2 – tinydancer9454 2013-03-12 03:59:24