- 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

13th Jan 2022, 5:50 PM
Mohamad Abdallah
Mohamad Abdallah - avatar
4 Respuestas
+ 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))
14th Jan 2022, 2:52 AM
Simba
Simba - avatar
+ 5
Why "Matching" and "Not matching"? And you don't even need to use if statement here.
14th Jan 2022, 2:36 AM
Simba
Simba - avatar
0
im new to programming thats what i assumed, can u please correct my assumption and tell me how can i solve it?
14th Jan 2022, 2:44 AM
Mohamad Abdallah
Mohamad Abdallah - avatar
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.
7th Sep 2023, 10:20 AM
Martin Stas
Martin Stas - avatar