for example if i wanted to add a list to another list, like:
a = [a,b,c]
b = [1,2,3]
my code:
def add(a, b):
a = a.append(b)
it would output ]
what do i have to change to make it output without using the .extend() method?
---
how can i create a function that can split a list into two lists with like equal elements in each list, which in the end both lists together would have all the elements in the original list?
like:
original = [1,2,3,4,5,6]
it would output something like
[1,2,3] [4,5,6]
def half(l):
a = []
b = []
for i in range(len(l)/2):
a = a + l[i]
for i in range(len(l)/2 - 1):
b = b+ l[i]
return a, b
I know it's something wrong with my for loops, the range?
---
Also just wondering is there any way to sort a list without using the .sort method?
like
[1,2,4,3,2]
will output
[1,2,2,3,4]
Thanks for any hints/help.