python sets | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

python sets

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. # I think I did everything right, but not passing the test, why skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} # given by test job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} #given by test print(skills & job_skills)

5th Jun 2021, 11:26 AM
Adilet Kambarov
Adilet Kambarov - avatar
9 Answers
+ 22
Maybe output should be a string not a set element. print(','.join(skills & job_skills)) or print(*(skills & job_skills))
5th Jun 2021, 12:32 PM
Simba
Simba - avatar
+ 4
I don't think there is any errors in your code. Maybe some error in output format, recheck the output format from the source of question.
5th Jun 2021, 12:15 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
31st Aug 2021, 3:32 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 2
Why Syntax “,”.join ? I don’t understend. Explain to me
31st Aug 2021, 12:48 PM
Вадим Крюков
+ 1
skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} for i in skills: for j in job_skills: if i==j: print(i)
14th Feb 2023, 4:10 PM
Mohith Vedulla
Mohith Vedulla - avatar
0
skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} print(*skills.intersection(job_skills))
9th Nov 2022, 7:38 AM
Kuang Hangdong
Kuang Hangdong - avatar
0
# Define the skills required for the job and candidate's skills as sets job_skills = {"Python", "JavaScript", "SQL", "Java", "React"} candidate_skills = {"JavaScript", "Java", "CSS", "React"} # Find the matched skills using the intersect operator matched_skills = job_skills & candidate_skills # Check if there are any matched skills if matched_skills: print("Matched skills:") for skill in matched_skills: print(skill) else: print("No matched skills found.")
6th Oct 2023, 8:42 PM
pavan lokhande
pavan lokhande - avatar
0
# Define the skills required for the job and the candidate's skills as sets job_skills = {"Python", "JavaScript", "SQL", "Java", "React"} candidate_skills = {"JavaScript", "Java", "CSS", "React"} # Find the matched skills using the intersect operator matched_skills = job_skills & candidate_skills # Check if there are any matched skills if matched_skills: print("Matched skills:") for skill in matched_skills: print(skill) else: print("No matched skills found.")
6th Oct 2023, 8:44 PM
pavan lokhande
pavan lokhande - avatar
- 2
Why Syntax “,”.join ? I don’t understend. Explain to me
29th Dec 2021, 1:39 PM
Amala Yakin