Python doesn't need to use a function to concatenate a list I'll tell you two ways not to use a function and how to use a function.
result = list1 + list2 + list3
result = []
result.extend(list1)
result.extend(list2)
result.extend(list3)
The difference is
list1+list2
returns the list
list1.extend(list2)
attaches an element of list2 to list1, so nothing returns.
So list1.extend(list2).You can't write like extend(list3)
.
© 2024 OneMinuteCode. All rights reserved.