Module 7/ Sets practice | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Module 7/ Sets practice

In this quest I should display the matching skills for the job description but I don't understand what is wrong. I used an intersection. skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} print(skills & job_skills)

18th Sep 2023, 5:38 AM
Leila July
Leila July - avatar
6 Answers
+ 4
You need to output 'HTML' as a string.
18th Sep 2023, 5:43 AM
Keith
Keith - avatar
+ 1
👍🤝
20th Sep 2023, 10:14 AM
Alex Nick
Alex Nick - avatar
0
Ok. How to do it?
19th Sep 2023, 11:33 AM
Alex Nick
Alex Nick - avatar
0
Because Set's are unordered you can use a for loop to iterate through the Set: for skill in (skills&job_skills): print(skill) Otherwise (skills&job_skills) on its own will just create a new Set.
19th Sep 2023, 12:15 PM
Keith
Keith - avatar
0
Thank you
11th Oct 2023, 6:29 AM
Jackson James
Jackson James - avatar
0
You can use the .join method: skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} operation = skills & job_skills result = ', '.join(operation) print(result)
26th Oct 2023, 3:12 AM
Fernanda
Fernanda - avatar