
Data Science Interview
92 of 257 Completed
Introduction
1m read
Basic Data Types
6m read
Iterables
6m read
Functions and Classes
5m read
Find the Missing Number
Question
Find Bigrams
Question
Merge Sorted Lists
Question
Permutation Palindrome
Question
Equivalent Index
Question
Find Bigrams
Write a function called find_bigrams
that takes a sentence or paragraph of strings and returns a list of all its bigrams in order.
Note: A bigram is a pair of consecutive words.
Example:
Input:
sentence = """
Have free hours and love children?
Drive kids to school, soccer practice
and other activities.
"""
Output:
def find_bigrams(sentence) ->
[('have', 'free'),
('free', 'hours'),
('hours', 'and'),
('and', 'love'),
('love', 'children?'),
('children?', 'drive'),
('drive', 'kids'),
('kids', 'to'),
('to', 'school,'),
('school,', 'soccer'),
('soccer', 'practice'),
('practice', 'and'),
('and', 'other'),
('other', 'activities.')]
Good job, keep it up!
35%
CompletedYou have 165 sections remaining on this learning path.
Loading pricing options...