+ 1
Stuck on Python Intermediate: "You are Qualified!" problem (sets)
Hi, I'm really stuck on this problem: https://www.sololearn.com/codecoach/1069?language=py I think it wants me to output the common value(s) between the two sets but the test fails when I attempt to run this: skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} print(skills & job_skills) I've added it to code playground so you can see what I've tried: https://code.sololearn.com/c862a9A22A20
13 Answers
+ 10
for i in skills & job_skills:
print(i)
+ 3
Felicity Ratcliffe
This is not a proper solution because there maybe more common language but you can also try this
lang = skills & job_skills
print (lang.pop())
+ 1
Felicity Ratcliffe
Yes that's what I said this is not a proper solution for more common Languages.
Check my statement once.
+ 1
I Am AJ ! my apologies, I thought you were referring to the previously provided solution, no worries, thank you
0
MSAS oh my goodness 😅thank you! That seems SO obvious now haha!
0
I Am AJ ! that only outputs the first common element though, and I think I need to output them all
0
I was also stuck on this and therefore found this thread when looking for a solution. I think the examples that belong to this exercise are chosen quite badly though, because they show exactly that
print(set1 & set2) should yield the wanted intersect result. That's why I also went for that answer, which didn't work. Still not sure why they chose these examples when they are actually not useful or working?
0
There is a formatting difference in return from from just using the print statement versus using the .pop statement, thanks I Am Time for the suggestion.
>>> skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'}
>>> job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'}
>>> print(skills & job_skills)
{'HTML'}
>>> match = skills & job_skills
>>> print(match.pop())
HTML
I think maybe a little bit more context around what the specific output needs to be format wise would be a little bit more helpful when doing the exercise.
0
i think the solution conatined the curly braces...
have you tried ahving teh solutio in list format?
try print(skills&job_skills)
0
I want to know why we used print(list(skills&job_skills)[0]) instead of print(skills&job_skills)
Could anyone help me in this problem
0
Why does the code not print the output like lists is it bc they arent lists?
0
Why using pop is necessary?
0
any solutions yet?