Skip to main content
Active reading.
Source Link
Peter Mortensen
  • 31.1k
  • 22
  • 111
  • 134

Append addadds the entire data at once. The whole data will be added to the newly created index. On the other hand Extend, extend, as it name suggests, extends the current array. for

For example

list1 = [123, 456, 678]
list2 = [111, 222]

when appendWith append we get:

result = [123, 456, 678, [111, 222]]

whileWhile on extendextend we get:

result = [123, 456, 678, 111, 222]

Append add the entire data at once. The whole data will be added to the newly created index. On the other hand Extend as it name suggests extends the current array. for example

list1 = [123, 456, 678]
list2 = [111,222]

when append we get:

result = [123,456,678,[111,222]]

while on extend we get:

result = [123,456,678,111,222]

Append adds the entire data at once. The whole data will be added to the newly created index. On the other hand, extend, as it name suggests, extends the current array.

For example

list1 = [123, 456, 678]
list2 = [111, 222]

With append we get:

result = [123, 456, 678, [111, 222]]

While on extend we get:

result = [123, 456, 678, 111, 222]

Append add the entire data at once. The whole data will be added to the newly created index. On the other hand Extend as it name suggests extends the current array. for example list1 = [ 123, 456, 678] list2 = [111,222]

list1 = [123, 456, 678]
list2 = [111,222]

when append we get: result= [123,456,678,[111,222]]

result = [123,456,678,[111,222]]

while on extend we get: result = [123,456,678,111,222]

result = [123,456,678,111,222]

Append add the entire data at once. The whole data will be added to the newly created index. On the other hand Extend as it name suggests extends the current array. for example list1 = [ 123, 456, 678] list2 = [111,222]

when append we get: result= [123,456,678,[111,222]]

while on extend we get: result = [123,456,678,111,222]

Append add the entire data at once. The whole data will be added to the newly created index. On the other hand Extend as it name suggests extends the current array. for example

list1 = [123, 456, 678]
list2 = [111,222]

when append we get:

result = [123,456,678,[111,222]]

while on extend we get:

result = [123,456,678,111,222]
Source Link
Shiv
  • 217
  • 2
  • 5

Append add the entire data at once. The whole data will be added to the newly created index. On the other hand Extend as it name suggests extends the current array. for example list1 = [ 123, 456, 678] list2 = [111,222]

when append we get: result= [123,456,678,[111,222]]

while on extend we get: result = [123,456,678,111,222]