使用" else"在python中

时间:2017-04-12 20:41:45

标签: python

我想知道如何让这个else语句正常工作。使用python

Dice = int(input("Please select number of dice you would like to use between 1 and 5")) 
if (Dice >= 1):
 else:
     condition == "Start"

2 个答案:

答案 0 :(得分:1)

你可能想测试数字1和5之间的输入

dice      = int(input("Please select number of dice you would like to use between 1 and 5: "))
condition = "Start"  if 1 <= dice <= 5  else "Other string"

答案 1 :(得分:0)

我猜你正在寻找的东西)

if (Dice >= 1):      
     condition = "Start"
else:
    condition = "Stop"