Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
546 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | Python (34 exercises) |
Topic ==> | Working with sets (1 exercise) |
Level ==> | Average difficulty |
Subject ==> | Python training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
Open the file in the above folder and update the file path to point to the above folder too:
# path where files are stored (you'll need to change this)
file_path = "c:\\wiseowl\\python\\"
Run the program - it should print out two lists of grand prix (one for 2022, and the other for 2023):
The program lists out the Grand Prix venues in 2022 and 2023, but there are discrepancies between the two years.
Create variables holding the two lists as sets instead (this will, miraculously, automatically remove any duplicates were there any), and list out all the elements in one set but not in both:
The events which happened in one year and not the other.
You can use the ^ set operator to get the elements which are in either set but aren't in both of them - written in set notation as (A ? B) / (A B).
When you've finished, take a moment to reflect on just how few lines of code that took, then close your file down.
You can find other training resources for the subject of this exercise here:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.