While loop help

thomasancilleri at gmail.com thomasancilleri at gmail.com
Tue Apr 9 12:24:15 EDT 2013


For system version I get this:
2.7.2 (default, Oct 11 2012, 20:14:37) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]

Also, I understand what your saying about the continuation code. There's no need for me to include it in each if/else statement, I could just use it at the end of the program outside of the statements and it would run no matter what. But, what I don't understand exactly is the while statement. I've been looking around a lot lately and notice that people say to use for instance:

while restart: or while true: or while restart = true:

What makes a statement true? Is there a way to return a true or false message. My method was to ask the user to type "true" and if that print statement matched restart = "true" then the loop would continue but i imagine there is a better way then matching strings and integers like i have been.

Also what confuses me is that python doesn't use brackets. How do I contain all of my if/else statements into one while loop? Do I have to indent each line of code and extra indentation? I'm used to highschool doing c++ and java when I would just say:

while (x<3) 
{
     if ()
    else ()
}



More information about the Python-list mailing list