+ 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
3 odpowiedzi
+ 5
Please post your code with below instructions so we can review the code.
https://sololearn.com/compiler-playground/Wek0V1MyIR2r/?ref=app
+ 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.
+ 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. 😉