Practice code in 'sets' lesson not accepted! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Practice code in 'sets' lesson not accepted!

Why this practice code in Python developer "Sets lesson" is not accepted. Despite the output is correct? Thank you skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} #Display the matched skill matched = skills & job_skills print(matched)

4th Oct 2023, 1:13 PM
Khelifa Benyoub
Khelifa Benyoub - avatar
3 Answers
+ 3
It is because the practice description is really bad. The answer is expecting HTML, not the set {HTML}. You have to find a way to output the element as a string.
4th Oct 2023, 1:24 PM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
Thank you
4th Oct 2023, 1:26 PM
Khelifa Benyoub
Khelifa Benyoub - avatar
+ 1
It works now👍 I used 'for in' loop. This is my new code: skills = {'Python', 'HTML', 'SQL', 'C++', 'Java', 'Scala'} job_skills = {'HTML', 'CSS', 'JS', 'C#', 'NodeJS'} #Display the matched skill matched = skills & job_skills for match in matched : print(match)
4th Oct 2023, 1:49 PM
Khelifa Benyoub
Khelifa Benyoub - avatar