PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/PayPal

Generate Bigrams Using Python List Comprehension and Zip

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in Python programming, particularly list comprehension, string tokenization, and sequence manipulation for generating consecutive word bigrams.

  • Medium
  • PayPal
  • Coding & Algorithms
  • Data Scientist

Generate Bigrams Using Python List Comprehension and Zip

Company: PayPal

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

##### Scenario Live Python exercise: generate all bigrams from an input string and iteratively optimize the solution. ##### Question Write a Python function that takes a sentence and returns a list of all consecutive word bigrams. Refactor the solution with list comprehension for conciseness. Can you further compress it into a single line? (Hint: consider using zip.) ##### Hints Think of zip(s.split()[:-1], s.split()[1:]) and join/format as needed.

Quick Answer: This question evaluates proficiency in Python programming, particularly list comprehension, string tokenization, and sequence manipulation for generating consecutive word bigrams.

Related Interview Questions

  • Minimize a String Using Allowed Swaps - PayPal (medium)
  • Compute variance of a list in Python - PayPal (easy)
  • Explain list vs tuple in Python - PayPal (easy)
  • Solve common search/parse/graph frequency tasks - PayPal (medium)
  • Explain differences between Python list and tuple - PayPal (hard)
PayPal logo
PayPal
Aug 4, 2025, 10:55 AM
Data Scientist
Technical Screen
Coding & Algorithms
5
0
Scenario

Live Python exercise: generate all bigrams from an input string and iteratively optimize the solution.

Question

Write a Python function that takes a sentence and returns a list of all consecutive word bigrams. Refactor the solution with list comprehension for conciseness. Can you further compress it into a single line? (Hint: consider using zip.)

Hints

Think of zip(s.split()[:-1], s.split()[1:]) and join/format as needed.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More PayPal•More Data Scientist•PayPal Data Scientist•PayPal Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.