+ 4

players = ["Alice", "Bob", "Charlie", "David", "Eve", "Frank"] #Create 3 lists with 2 players each #Use slicing to create a lis

There is a list of players metion in the question i have to silce them up into three group with two players Expected output would be like this Group 1 ['player 1 , player 2 '] And so on group 2 and group 3 Please help me with this immediately

30th Nov 2023, 1:19 PM
Payal Agrawal
3 odpowiedzi
+ 5
Please post your code with below instructions so we can review the code. https://sololearn.com/compiler-playground/Wek0V1MyIR2r/?ref=app
30th Nov 2023, 2:02 PM
Wong Hei Ming
Wong Hei Ming - avatar
+ 4
Review your slicing module. To create a slice, specify a new variable to contain your slice and then specify what section of the original it will hold. list = ['item 1', 'item2', 'item 3', 'item 4'] slice = list[0:2] This slice will hold the first 2 elements of the list. Remember - The first element in a list is numbered 0. The start of the slice is the first element to INCLUDE The end of the slice is the first element to NOT INCLUDE. Extend this solution to make your 3 groups.
30th Nov 2023, 1:49 PM
StuartH
StuartH - avatar
+ 4
I assume you are using python. Take a look to this lesson. https://www.sololearn.com/learn/o-Python/2453/?ref=app Generally use better tags than 'help'. For example Python and slice. And try to descripe where do you stuck. You can also post your code to show us your attempt. 😉
30th Nov 2023, 1:58 PM
Stefanoo
Stefanoo - avatar