Skip to content
Learnearn.uk » Python Unit Home » Python Sets Challenges

Python Sets Challenges

Tutorial Video

Cheat Sheet

Challenge 1

Challenge 1 – Important the datasets

You’ve managed to gain a job in the admin department of a local Gym and they want you to find out some information about their members. All the data is stored inside of text(txt) and comma separated values(csv) files. Your first task is to load the data into Python!

Bronze   

Read the data in the from the following files and store the data in Python sets using the variable names listed below


Silver 

Have your program display the length of each set so that the output is as follows:

2020 Members : 190

2021 Members : 239

2022 Members : 296

 


Gold 

Incorporate a function called load_data_set() into your program. It should take a file name as an argument and return the required set.

 

2

Challenge 2 – Find out who has been a member for all three years.

The company wants to send out a letter thank their most loyal customers who have been members for all three years.

Bronze   

Write a program that prints out the names of all members who have been members for all of the last three years


Silver 

Order the data so that the names are sorted in alphabetical order


Gold 

Order the data so that the names are sorted by surname, not forename

3

Challenge 3

Bronze   


Silver 


Gold 

4

Challenge 4

Bronze   


Silver 


Gold 

5

Challenge 5

Bronze   


Silver 


Gold 

6

Challenge 6

Bronze   


Silver 


Gold 

7

Challenge 7

Bronze   


Silver 


Gold 

8

Challenge 8

Bronze   


Silver 


Gold 

9

Challenge 9

Bronze   


Silver 


Gold 

10

Challenge 10

Bronze   


Silver 


Gold 

Resources

https://www.w3schools.com/python/python_sets.asp

 

 

https://learnlearn.uk/wp-content/uploads/2022/09/emails.csv