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
12 ответов
+ 26
print(' '.join(skills & job_skills))
+ 12
skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'}
job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'}
print(*skills & job_skills)
+ 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());
+ 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
+ 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
+ 2
My Answer:
skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'}
job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'}
skill = skills & job_skills
print (skill.pop());
+ 1
Thank you for your help, I really appreciate it.
+ 1
print(' '.join(skills & job_skills))
Кто-нибудь может объяснить почему этот способ сработал?
+ 1
print(' '.join(skills & job_skills)) вероятно сработал, потому что на выходе хотят получить значение без кавычек и скобок
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)
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 "
0
BTW :)
i know that there is a "typo" but it dosnt change ANYTHING :D
↓
print(skils & job_skills)