193k views
5 votes
Create a for loop that prompts the user to enter 3 different items, then appends them to new items list

User Rlasch
by
3.7k points

1 Answer

2 votes

Answer:

new_items = []

for i in range(3):

item = input("Enter an item: ")

new_items.append(item)

print(new_items)

Step-by-step explanation:

*The code is in Python.

Create an empty list called new_items

Create a for loop that iterates three times. Inside the loop, ask the user to enter an item. Append the item to the new_items using the append method.

When the loop is done, print the new_items

User Vlince
by
3.7k points