Can someone explain why this code isn't being accepted in the practice problem? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain why this code isn't being accepted in the practice problem?

You are working on a recruitment platform, which should match the available jobs and the candidates based on their skills. The skills required for the job, and the candidate's skills are stored in sets. Complete the program to output the matched skill. You can use the intersect operator to get the values present in both sets. https://code.sololearn.com/c5crkue5wa6i/?ref=app https://code.sololearn.com/c5crkue5wa6i/?ref=app

14th Apr 2021, 2:53 AM
Ify Nonyelu
12 Answers
+ 26
print(' '.join(skills & job_skills))
14th Apr 2021, 3:43 AM
Ahmed Yasser
Ahmed Yasser - avatar
+ 12
skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} print(*skills & job_skills)
29th Oct 2022, 11:38 AM
Виталий Меншиков
Виталий Меншиков - avatar
+ 8
Yetco As there is single common set so pop method will also help you to get result skill = skills & job_skills print (skill.pop());
14th Apr 2021, 5:04 AM
A͢J
A͢J - avatar
+ 6
The output here is {'HTML'} Try to print like plain HTML Store the common value in another set or list and print one by one using index value I hope this will work
14th Apr 2021, 3:41 AM
Arun Ruban SJ
Arun Ruban SJ - avatar
+ 2
skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} # Candidates skills job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} # Skills required match = skills.intersection(job_skills) # Find matches print(match.pop()) # Pop the match out so we are not just printing a set with # the curly braces and everything
9th Jan 2022, 3:25 PM
Andrew Sharon
+ 2
My Answer: skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} skill = skills & job_skills print (skill.pop());
10th Nov 2022, 8:19 AM
Pooja Patel
Pooja Patel - avatar
+ 1
Thank you for your help, I really appreciate it.
14th Apr 2021, 3:52 AM
Ify Nonyelu
+ 1
print(' '.join(skills & job_skills)) Кто-нибудь может объяснить почему этот способ сработал?
13th Dec 2021, 6:11 PM
Roman Stribunov
Roman Stribunov - avatar
+ 1
print(' '.join(skills & job_skills)) вероятно сработал, потому что на выходе хотят получить значение без кавычек и скобок
4th Jan 2022, 6:35 AM
Aleksandr Suprun
Aleksandr Suprun - avatar
0
skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} # skills of candidates job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} # the skill required to the job # the first way print(skills & job_skills) # second way newSet = set() for i in skills: if i in job_skills: newSet.add(i) print(newSet) # the 3rd way skiset = {i for i in skills if i in job_skills} print(skiset)
24th Nov 2021, 11:09 PM
Mohammad Jamal Mahmoud Al Jadallah
Mohammad Jamal Mahmoud Al Jadallah - avatar
0
Hello you there, so... what can i say or asked you :D probably i dont understand something here ######## look at this code ############# ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ first = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} second = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} print(first | second) print(first & second) print(first - second) print(second - first) print(first ^ second) ############ output ################## ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ {'CSS', 'Python', 'C#', 'C++', 'Scala', 'SQL', 'NodeJS', 'Java', 'JS', 'HTML'} {'HTML'} {'Python', 'Scala', 'SQL', 'Java', 'C++'} {'C#', 'NodeJS', 'JS', 'CSS'} {'CSS', 'Python', 'SQL', 'NodeJS', 'Java', 'C#', 'Scala', 'C++', 'JS'} and everythis is fine according to this lesson: "SETS" but... yeap there is always but :D when i tring compiled this code :D it dosnt work :D And my questio is.... WHY ? :D #########orginal name of variables :D ################# ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} ##### my "solution" according to lesson "SETS" ######## ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ print(skils & job_skills) so... WHY ? " TEST CASE 1 " == FAILED ! :D almost like " SOLOLEARN FATALITY:D "
20th Mar 2023, 8:47 PM
Pawel
Pawel - avatar
0
BTW :) i know that there is a "typo" but it dosnt change ANYTHING :D ↓ print(skils & job_skills)
20th Mar 2023, 8:53 PM
Pawel
Pawel - avatar