PDA

View Full Version : Translate please



swoll1980
April 5th, 2008, 06:59 AM
I'm learning python through a tutorial. in this command

while X != "":
what is the computer waiting for? I know

while x <= 10
would make the computer wait for X to become larger than 10, but there is no explanation for what
while X !="": actually does

LaRoza
April 5th, 2008, 07:01 AM
!= means "not equals"

I take it from the example that x may change, and is probably user input. It means that:

while x does not equal empty do:

So pressing "enter" with nothing, would end the loop.

swoll1980
April 5th, 2008, 07:15 AM
you were right about user input. Next time I will specify so it's clear.To make sure I have this right. In the example the computer sees any kind of input from the user as unequal to empty, and continues the program. but if the user leaves the space blank the computer sees it as equal to empty and terminates