Last answered:

14 Nov 2021

Posted on:

21 Oct 2021

1

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 ?! image

6 answers ( 0 marked as helpful)
Instructor
Posted on:

24 Oct 2021

2

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

Posted on:

28 Oct 2021

1

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.

Posted on:

28 Oct 2021

0

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() ...

Instructor
Posted on:

06 Nov 2021

1

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

Posted on:

13 Nov 2021

0

Thank you

Instructor
Posted on:

14 Nov 2021

0

You are very welcome!
Best,
Martin

Submit an answer