print(range( )range( in many ways the object returned by range(behaves as if it is listbut in fact it isn' it is an object which returns the successive items of the desired sequence when you iterate over itbut it doesn' really make the listthus saving space we say such an object is iterablethat issuitable as target for functions and constructs that expect something from which they can obtain successive items until the supply is exhausted we have seen that the for statement is such an iterator the function list(is anotherit creates lists from iterableslist(range( )[ later we will see more functions that return iterables and take iterables as argument break and continue statementsand else clauses on loops the break statementlike in cbreaks out of the innermost enclosing for or while loop loop statements may have an else clauseit is executed when the loop terminates through exhaustion of the list (with foror when the condition becomes false (with while)but not when the loop is terminated by break statement this is exemplified by the following loopwhich searches for prime numbersfor in range( )for in range( )if = print( 'equals' '*' //xbreak elseloop fell through without finding factor print( 'is prime number' is prime number is prime number equals is prime number equals is prime number equals equals (yesthis is the correct code look closelythe else clause belongs to the for loopnot the if statement when used with loopthe else clause has more in common with the else clause of try statement than it does that of if statementsa try statement' else clause runs when no exception occursand loop' else clause runs when no break occurs for more on the try statement and exceptionssee handling exceptions the continue statementalso borrowed from ccontinues with the next iteration of the loopfor num in range( )if num = print("found an even number"numcontinue print("found number"numfound an even number (continues on next page break and continue statementsand else clauses on loops