Secret Santa

Learning Objectives

This set of challenges focuses on the use of lists in Python. You will learn how to:

  • Initialise a list
  • Add and remove values to a list
  • Find out the length (number of items) of a list
  • Access specific items based on their position in the list
  • Shuffle the content of a list

Before completing this challenge you may want to read more about how Python lists work.

Challenge #1: Random Name Picker

This first challenge is done for you and gives you example of how list can be used to create a random name picker.
The challenge consists of randomly picking up 3 names from a list of pupils’ names and to make sure the same pupil cannot be picked up twice.


Challenge #2: Secret Santa

The second challenge consists of organising a Secret Santa list from a list of pupils. The program should output a list where all pupils is given the name of another pupil for who they need to get a present. For instance the output of the program may look like this:

    Laura will get a present for Tobby.
    Ryan will get a present for Laura.
    Tobby will get a present for Ryan.

With this challenge you will need to make sure that every pupil does receive a present and that a pupil does not end up having to give themselves a present.



The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!