while statements

Francesco Guerrieri f.guerrieri at gmail.com
Tue Oct 16 15:50:35 CEST 2007


On 10/16/07, danfolkes <danfolkes at gmail.com> wrote:

> Instead of: if(cal<=0)
>
> you could do :
> cal=0
> while cal<=0:
>     cal = int(raw_input("Please enter the number of calories in your
> food: "))
>
> that would make sure that your input is > 0

Calories could be non integer :)

francesco



More information about the Python-list mailing list