How loops can be utilized in list processing; Python Example
- Steven Belanger
- Oct 23, 2021
- 1 min read
A list is created by first naming the list. In this case, we will use "shoppinglist". You would then create a relationship to the list with and '=' (equals sign) followed by your items in brackets ('[]'). Each of the items need to have a single quote wrapping the item individually and must be separated by a comma ( , ) outside of the single quote.
To print the shopping list, we will use a 'for' statement loop to iterate though the list. Lesson: always use appropriate indentation. I made that easy mistake the first time I tried the program.

Commentaires