91850/how-to-convert-list-into-2-tuple-pair-list
How to convert the list into 2 tuple pair lists?
I'll give an example:
L = [1,1,2,2,1,2] / i want the above list to L2 = [(1,1) , (2,2) ,(1,2)]
This should work:
L = [1, 2, 3, 4, 5, 6] L2 = [] for i in range(0, len(L), 2): L2.append((L[i], L[i+1])) print(L2)
Try like this, it will give you ...READ MORE
Hey, To split a string you can use ...READ MORE
Hi@akhtar, Say, you have one list A. Now convert ...READ MORE
Hi@akhtar, You can convert your dataframe into list. ...READ MORE
You can also use the random library's ...READ MORE
Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE
Enumerate() method adds a counter to an ...READ MORE
You can simply the built-in function in ...READ MORE
Hi, @Roshni, You can use Python <split()> function ...READ MORE
A simple example using com types, converting ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.