+ 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

17th Mar 2021, 10:56 AM
Felicity Ratcliffe
Felicity Ratcliffe - avatar
13 ответов
+ 10
for i in skills & job_skills: print(i)
17th Mar 2021, 11:02 AM
TOLUENE
TOLUENE - avatar
+ 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())
17th Mar 2021, 11:48 AM
A͢J
A͢J - avatar
+ 1
Felicity Ratcliffe Yes that's what I said this is not a proper solution for more common Languages. Check my statement once.
17th Mar 2021, 12:33 PM
A͢J
A͢J - avatar
+ 1
I Am AJ ! my apologies, I thought you were referring to the previously provided solution, no worries, thank you
17th Mar 2021, 3:37 PM
Felicity Ratcliffe
Felicity Ratcliffe - avatar
0
MSAS oh my goodness 😅thank you! That seems SO obvious now haha!
17th Mar 2021, 11:05 AM
Felicity Ratcliffe
Felicity Ratcliffe - avatar
0
I Am AJ ! that only outputs the first common element though, and I think I need to output them all
17th Mar 2021, 12:04 PM
Felicity Ratcliffe
Felicity Ratcliffe - avatar
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?
14th Jun 2021, 11:00 PM
Judith Levy
Judith Levy - avatar
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.
8th Jul 2021, 2:48 PM
James
James - avatar
0
i think the solution conatined the curly braces... have you tried ahving teh solutio in list format? try print(skills&job_skills)
6th Oct 2021, 8:58 AM
ajey james kariuki
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
23rd Aug 2022, 5:08 PM
JONNAKUTI KIRAN BABU
JONNAKUTI KIRAN BABU - avatar
0
Why does the code not print the output like lists is it bc they arent lists?
4th Nov 2022, 11:44 AM
Wilbert Henriquez
0
Why using pop is necessary?
6th Sep 2023, 10:44 AM
Pravin
Pravin - avatar
0
any solutions yet?
10th Oct 2023, 11:49 AM
Samruddhi Gawande
Samruddhi Gawande - avatar