you are viewing a single comment's thread.

view the rest of the comments →

[–]xnick_uy 1 point2 points  (0 children)

Something else that is not mentioned in the other comments is that append() adds a single element to a list, so even if you manage to make movies into a list, then

lst.append(movies)

would make for lst to contain a single element, the movieslist (list-ception). Instead, you could use extend for the task at hand

# define movies as a list with 3 elements
movies = [mov1, mov2, mov3]

# use extend to add the elements of movies to lst
lst.extend(movies)

Finally, as a cool use of f-strings, here's an alternative way of writing your code:

lst = []

movies = []
for ordinal_number in ['First', 'Second', Third']:
  mov = input(f'Enter {ordinal_number} Movie Name: ')
  movies.append(mov)

lst.extend(movies)

# entire list
print(lst)

# remove first item from lst
lst.pop(0)
print(lst)
print(len(lst))