+ 2

What is problem in this code? Can you give me the right code!!

Suppose 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.you can use intersection operator. Complete the program to output the matched skill. According to this question what problem occurs in below code . Can you give me the solution skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} n = input() s = skills & job_skills if n in s: print(n)

12th Jun 2024, 1:56 PM
Mehak Parveen
7 Respuestas
+ 8
there is no input in that practice print(*s)
12th Jun 2024, 4:52 PM
A͢J
A͢J - avatar
+ 6
Mehak Parveen , the output in variable `s` is already done in your code and contains the correct value(s), we just have to print it without curly braces as string(s). this can be done like: ... for item in s: print(item, end = ' ') or as A͢J mentioned by using the depack operator `*`.
12th Jun 2024, 5:01 PM
Lothar
Lothar - avatar
+ 4
It looks like you don't need to accept input. https://www.sololearn.com/Discuss/2788435/?ref=app
12th Jun 2024, 2:12 PM
Ausgrindtube
Ausgrindtube - avatar
+ 4
If I recall correctly, the output is not a set, but a string.
12th Jun 2024, 3:39 PM
Wong Hei Ming
Wong Hei Ming - avatar
+ 4
Wilbur Jaywright in this context the & operator has operands that are sets. The & operator gets overloaded to become a set intersection operator. https://www.pythontutorial.net/JUMP_LINK__&&__python__&&__JUMP_LINK-basics/python-set-intersection/
12th Jun 2024, 4:54 PM
Brian
Brian - avatar
0
The & operator does not do what you think it does. It does not concatenate, it is a bitwise AND operator.
12th Jun 2024, 2:12 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
0
If you are using Java than use lambda operator to find matching skill. In both the input
14th Jun 2024, 11:15 AM
sandeep vats
sandeep vats - avatar