0

I am stuck in Python Developer, Collection Types, Sets Practice

Two sets need to be intersected. One set is skills and the other is job_skills. My code reads: print(skills & job_skills) My Output is: {'HTML'} Whis is the correct output when working with sets. The Expected Output is: HTML How? So my code is flagged as buggy and I cannot continue. And I am running a 323 days streak, which will be broken.

28th Oct 2023, 2:23 PM
Kennard Nahar
Kennard Nahar - avatar
2 odpowiedzi
+ 4
Do this print(*(skills & job_skills))
28th Oct 2023, 3:26 PM
A͢J
A͢J - avatar
+ 4
The reason the answer given by A͢J works is because the '*' tells python to unpack the Set. Otherwise, you are just creating a new set and would need to iterate through it to get the correct output.
28th Oct 2023, 4:59 PM
Keith
Keith - avatar