list1 = ["yummy", "brown", "cool"] list2 = ["fox", "putin", "pluto"] while True: ch1 = input("Choose the First Character of Your Password, yummy_brown_cool: ") ch2 = input("Choose the Second Character of Your Password, fox_putin_pluto: "
我有一个家庭作业的问题,状态使用random.choice函数来模拟骰子的滚动。。它仍将模拟将六面骰子滚动1000次。我必须像0,1000那样输入列表吗?还是有一种更简单的方法。for i in range(1000): #get a random number out of the list
roll = random.choice
我正在运行一个for -循环,它为每次迭代打印random.choice值(“黑色”或“红色”)。for i in range(10): print(i, random.choice(foo))
if random.choice(foo)“的第一次执行会随机选择”黑色“或”红色“。但是,if-函数中的"random.choice(foo)“显然会选择