Solution: Favorite Things
This program uses a for loop to go through a list of favorite activities and print each one in a sentence.
favoritesis a list, a collection of items stored in square brackets[ ].The
forloop goes through each element in the list, one at a time.Each time the loop runs, the variable
itemtakes the next value from the list.The
print()statement displays a sentence using that item.
Solution: Favorite Things
This program uses a for loop to go through a list of favorite activities and print each one in a sentence.
favoritesis a list, a collection of items stored in square brackets[ ].The
forloop goes through each element in the list, one at a time.Each time the loop runs, the variable
itemtakes the next value from the list.The
print()statement displays a sentence using that item.