Hameed U. Khan wrote:
This else is the part of the for loop. And the statements in this else will be executed if your for loop will complete all of its iterations. if you want this else with 'if' statement then remove the for loop.

Or if you want the for loop to be part of the if then indent the for: if z in x: print 'found:', z for i in x: print 'in the loop with', i else: print 'not found:', z

Remember - indentation is syntactically significant in Python!

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to