0

Write a program to exchange first half elements of a list with the second half elements of the list

2nd Nov 2019, 5:49 PM
sachitha
sachitha - avatar
3 odpowiedzi
+ 4
First try to do by yourself.
2nd Nov 2019, 6:02 PM
A͢J
A͢J - avatar
0
Have a look at list slicing and how you can concatenate lists. also:- You can append a popped item... put it in a loop that's loops through half the length of the list, just bare in mind where halfway is if your list has an odd number of elements. (but..... I'm sure someone's gona come up with a one-liner to do it.)
2nd Nov 2019, 9:34 PM
rodwynnejones
rodwynnejones - avatar
- 1
Mf
13th Feb 2022, 7:07 AM
Sub d