我正在做一个程序,产生一个单一的淘汰赛。到目前为止,我的代码是这样的(我刚刚开始)
amount = int(raw_input("How many teams are playing in this tournament? "))
teams = []
i = 0
while i<amount:
teams.append(raw_input("please enter team name: "))
i= i+1
现在我被卡住了。我想随机选择2个数字,将选择面对面的球队。数字不能重复,必须在1到“金额”之间。最有效的方法是什么?在
我想那应该行得通。在
看一下^{} 模块。在
我不完全确定你要的是什么,但是你可以选择随机数,例如
这将给你一个介于1到10之间的随机数
注意:您需要导入随机模块
^{pr2}$相关问题 更多 >
编程相关推荐