Sequential Word Pairs
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L3
Problem
Given a text string, split on whitespace and return a list of consecutive 2-word pairs as [word_i, word_{i+1}]. Return empty list if fewer than 2 words.
Summary
Everything has a neighbor.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.