while循环和布尔值

时间:2017-06-18 01:13:23

标签: python while-loop boolean

不了解如何让循环停止并继续/重复 另外,不了解如何使布尔的第二部分工作

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" )

1 个答案:

答案 0 :(得分:0)

Nimkora,

你只需要在while循环结束时添加另一个赋值语句,这样,一旦用户输入一个有效的输入,程序就可以打破while循环。

app.post('/signUp', (req, res) => {
    res.end("it worked!!");
});