【发布时间】:2017-11-20 12:11:00
【问题描述】:
不明白如何让循环停止并继续/重复 另外,不了解如何使布尔值的第二部分起作用
monthly_investment = float(input("Enter monthly investment:\t"))
while monthly_investment < 1:
print("Entry must be greater than 0")
yearly_interest_rate = float(input("Enter yearly interest rate:\t"))
while yearly_interest_rate < 1 and yearly_interest_rate < 16:
print("Entry must be greater than 0 and less than or equal to 15" )
【问题讨论】:
-
我理解循环只是不知道如果值为 o 时如何返回
-
回到哪里?如果您想根据条件做某事,请使用 if 语句
-
有道理,谢谢。
标签: python while-loop boolean