Skip to content » Python Unit Home » Topic 6 – Lists (1 dimensional arrays)

Topic 6 – Lists (1 dimensional arrays)

Tutorial Video

Cheat Sheet

Python Lists Cheat Sheet

#Create an empty list

l = [] 

#Create a list with items in it
l = ["dog","cat","mouse"]

#get the user to add items to a list
for i in range(5):
    l.append(input("What to add?"))

#print all items in a list
for item in l:
    print("Your item is  -", item)

#remove the last item from a list:

#remove the first item from list

#remove a item and save it to a variable
chosen = l.pop()

#reverse a lit

#sort a list

#see if an item is in a list
if "dog" in l:

# Find the index of an item

# replace an item at a specific index in a list
l[3] = "cat"

Challenge 21

Challenge 21 – Favourite Movies

The user should be asked to enter the names of their 5 favourite movies.


  • Your program should ask the user to enter 5  movie titles into a list
  • Once the user has entered all 5 names, the list contents should outputted back to the user


  • Your program should sort the list into Alphabetical order


  • Your program should ensure that the user’s input is valid, for each movie title entered


Challenge 22 – Race Recorder

Write a program that allows the user to enter the names of each person that finishes a running race. The program should then print out the full list of runners in the race, together with their position.


  • The program should ask the user to enter 5 names
  • The program should then print out a list of names, with each runner’s position next to them.


  • The program should be adapted to allow the user to keep entering as many names as they like. The program should stop asking for more names when the user presses enter with an empty name.
  • The program should include the option to find a runner’s position in the race, if you enter their name.


  • The program should include menu functions with options for separate screens.


Challenge 23 – Shop Takings

Write a program that asks the user to enter the daily takings for a shop, for a week.


  • The program should ask the user to enter 7 values
  • The program should store each of the values in a list
  • The program should print out the list at the end of the week
  • The program should print out the total takings for the week.


  • The program should display the minimum, maximum and average daily takings for the week.
  • The program should format the data in a suitable manner (make it look pretty)


  • The program should check the values entered each time to ensure that the are integers and repeat the question until a valid response is entered.


Challenge 24 – Card Picker


  • Create a program that generates a list of the 52 cards from a standard deck of cards, excluding the jokers.
  • Your program should then pick a random card from the deck and output the chosen card to the user.


  • Your program should automatically create the list using loops, rather than the whole list of cards being manually typed out.


  • Each time a card is drawn, your program should remove that card from the list, so that it can be drawn again.