list doesn't have add() !!
in the introduction to lists practice exam the question number 6 it asks me to combine 2 lists but it didn't show extend() option and instead in the first choice (which i found that it is the right one after reviewing the answers the answer model provides as shown in the picture) it uses add() and lists doesn't use add() it's the sets .. so is it an older version of python or it's a bug or what ?!
Hi Abdulrahman!
Thanks for reaching out.
Your comment is spot on. We've made a mistake in the suggested answers and marking the correct one. We will update this question as soon as possible, so that it provides/marks the correct answer.
Hope this helps.
Best,
Martin
I don't think it's even the extend mode. '+' is what worked for me when I tested the answers in Python 3. So confused please help with the correct answer.
yeah i know the '+' one works , i also tested it using jupyter but the question ( as far as i know ) suppose to test ur knowledge from the course so i assumed it means extend() ...
Hi Sachintha and Abdulrahman!
Sometimes, there are several ways to obtain a certain result in Python. Such is the case here - we can use .extend() or just combine the two strings by using the + operator.
It depends on the situation/the given task which of the two you may prefer to use but it is good to know how to work with both.
Hope this helps.
Kind regards,
Martin
Thank you