I ran the code in repl.it it works. Cannot get the same result in the exercise. This is about using the & operator to find the intersection of 2 sets.
1/12/2022 1:14:49 AM
shriram gharpure4 Answers
New Answershriram gharpure , the output should be a *string*. unfortunately sololearn has removed the descriptions for input and output data in this exercise. the output of an operation with the "intersect operator" "&" is a set, so the output is: {'HTML'} to get this to a string, we can use the *splat* operator to *unpack* the element from the set: print(*(skills & job_skills)) we can also omit the additional pair of parenthesis in this case, but using the parenthesis is more obvious what we are going to achieve. happy coding!
skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} print(skills & job_skills)
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message