如何在使用 if 语句时运行随机程序?

时间:2021-04-11 17:29:03

标签: python

if (response11 == 'slowly' or response11 == 'slow'):
  def dice_roll()
  DiceRoll = random.randint(1,2)
  return DiceRoll
  if (DiceRoll == 1):
    print('Bad luck, you were too slow\n\nand got eaten by the bugs!')
    time.sleep(4)

我不确定这是否接近于如何去做,但这就是我想出的。它在 def dice.roll() 行出错。我正在尝试获取它,因此它可以随机化缓慢移动的机会,无论是工作还是不工作。例如;它扮演骰子的角色,如果它落在 1 上,那么你就死了,但如果它落在 2 上,你就可以生存。

0 个答案:

没有答案
相关问题