CGSC 1005 Lecture 13: COMP SCI Oct. 31
Document Summary
Nested loops prints each individual element of each individual string and prints. Still here" after each iteration of the outer loop for every string. To date we have focused on lists whose elements themselves are not lists either numbers or strings. We can traverse access each individual element by using loops. Caveat about modifying lists, using append the list must already exist. Caveat about modifying lists, using [ pos ] the position must be valid. Append adds an element onto the end of an existing list. Will look for bob" in each inner element and when it find it print aha". We can access elements of the nested lists using the [ ] operator. When a for loops runs, python grabs the next element of a sequence and assigns it to the loop variable. The type of that loop variable depends on what the list contains. If the list contains lists then ele will be a list.