On Friday, August 2, 2013 5:40:52 PM UTC-7, kevin...@gmail.com wrote:
>     Basically, my code is ignoring the if's and else's. I don't get why.
> Everything appears to be positioned correctly, but for some odd reason, even
> after an if, the program also runs the else as well.

Look carefully at your indentation.  One "else" statement is at the same 
indentation as a "for" statement rather than an "if" statement.  So what, you 
say?

http://docs.python.org/2/tutorial/controlflow.html

"Loop statements may have an else clause; it is executed when the loop 
terminates through exhaustion of the list (with for) or when the condition 
becomes false (with while), but not when the loop is terminated by a break 
statement."

I don't know of any other computer programming language besides Python which 
has the "for...break...else" idiom.  However, I know quite a few that do not.  
I find it useful in many situations.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to