I am working on 4-11 in Python Crash Course for reference. My task is to
Print the message My favorite pizzas are:, and then use a for loop to print the list.
fav_pizzas = ['pepperoni', 'pineapple', 'cheese']
friend_pizzas = fav_pizzas[:]
fav_pizzas.append('meat lovers')
friend_pizzas.append('veggie')
print(f"My favorite pizzas are: {fav_pizzas}")
print(f"My My friend's favorite pizzas are: {friend_pizzas}")
While I understand the concept of using list comprehension such as:
odd_nums = [odd_num for odd_num in range(1, 21, 2)]
I am not sure how I would accomplish this with a list. Deep down I know the most logical way would be to just create a new variable and do something like:
space = " "
print(f"My favorite pizzas are, {space.join(fav_pizzas)}")
But the task is asking me to use a for loop. If I am TOTALLY off the mark. Please do not hesitate to shame me, I am new to programming/coding and I expect it.