Python: Pair up the consecutive elements of a given list
Pair Consecutive Elements in List
Write a Python program to pair consecutive elements of a given list.
Visual Presentation:

Sample Solution:
Python Code:
Sample Output:
Original lists: [1, 2, 3, 4, 5, 6] Pair up the consecutive elements of the said list: [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]] Original lists: [1, 2, 3, 4, 5] Pair up the consecutive elements of the said list: [[1, 2], [2, 3], [3, 4], [4, 5]]
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to pair consecutive elements in a list and compute the sum of each pair.
- Write a Python program to pair consecutive elements in a list only if the first element is less than the second.
- Write a Python program to pair consecutive elements in a list and output the pairs as tuples.
- Write a Python program to pair every two consecutive elements in a list and then swap the order of each pair.
Go to:
Previous: Write a Python program to convert a given unicode list to a list contains strings.
Next: Write a Python program to check if a given string contains an element, which is present in a list
Python Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.