【发布时间】:2019-01-28 20:23:23
【问题描述】:
S0,基本上,我写了一个更长的程序,用另一种语言测试我的时态。它根据掷骰子随机测试我。但是,由于某种原因,我引用的 sn-p 不起作用。问题是如果我输入“现在”或“未来”会跳到其他部分。 “两者”出于某种原因起作用。我究竟做错了什么?这真的让我很烦,因为我看不出它有什么问题。
tenses_tested = input("Would you like to be tested on the present, future simple, or both?")
if "present" in tenses_tested:
roll_range = 6
roll_addition = 0
if "future" in tenses_tested:
roll_range = 6
roll_addition = 6
if "both" in tenses_tested:
roll_range = 13
roll_addition = 0
else:
print("Something went wrong because this keeps coming up...")
roll_range = 13
roll_addition = 0
【问题讨论】:
-
使用 else if's 而不是 just if's
标签: python python-3.x string python-2.7 substring