- 1
You are working on a recruitment platform, which should match the available jobs and the candidates based on their skills. The s
hello guys, this is the practice exercises in the sets part of python intermediate course, my answer was: if skills in job_skills: print(skills & job_skills) print("Matching) else: print("Not matching") can someone please tell me what i did wrong? and how can i fix it? thank u
4 Antworten
+ 6
All you need to find a value that presents in both sets using & operator.
In this case, it returns a set element but you need to convert it to a string.
You may try something like this
print(*(jobs_skills & jobs))
+ 5
Why "Matching" and "Not matching"?
And you don't even need to use if statement here.
0
im new to programming thats what i assumed, can u please correct my assumption and tell me how can i solve it?
0
Hey there, Mohamed Abdallah!
It's great to see you working on a recruitment platform project in Python. Your code snippet is on the right track, but there are a couple of tweaks needed to make it work correctly. Try learning more here: https://www.hrdive.com/press-release/20230831-andersen-creates-an-innovative-etraining-and-online-staff-recruitment-platf/, or take my advice.
Firstly, it seems like you want to check if there are any matching skills between the job_skills and the candidate's skills. The '&' operator is used for bitwise AND in Python, so it might not give you the desired outcome for comparing lists.
To achieve your goal, you can use the set intersection method, which will return a set of matching skills. Here's a revised version of your code:
python
matching_skills = set(skills) & set(job_skills)
if matching_skills:
print("Matching skills:", matching_skills)
else:
print("Not matching")
This code snippet converts both skills and job_skills into sets and then finds the common elements (matching skills) between them.
I hope this helps! Keep up the good work on your recruitment platform project.