Question: Exercise 3 : A function that returns a list of substrings Write a function substring ( string _ original, n ) that takes a string

Exercise 3: A function that returns a list of substrings
Write a function substring(string_original, n) that takes a string parameter string_original, and an integer parameter n, and returns a list containing every possible substrings of string_original of length n.
Include the following function calls:
print(substring("Hippopotamus",2))
# You should see ['Hi','ip','pp','po','op','po','ot','ta','am','mu','us']
print(substring("Abcdefg",4))
# You should see ['Abcd', 'bcde', 'cdef', 'defg']
Exercise 3 : A function that returns a list of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!