PY LOOP Flashcards
Briefly describe the For Loop
program execution checks for iterable entities . I available then program executes it and checks for any next item. If yes then statement is executed and if no then the for loop is deemed complete and the execution continues with the next statements outside for structure.
______ FXN indicates the number of iterations of the for loop and used to generate a sequence and performs an action a specific number of times.
range
_____ statements inside the for loops are executed once for each value in the range
Indented
What code do we use to print a sequence in a row?
print(x, end=””)
What does the end function do?
used to add any string at the end of the output of the print statement in py
_____ can be used with the for loops to create conditional statements
IF
how can we write a code to print and sum odd numbers ?
the key step is for x in range (1,10,2); the 2 indicates an increment by 2 starting rom 1 which ofc will be an odd number
OR
using x%2 !=0
____ is used to get out of the loop
BREAK