Question: python Write a function replicate(sentence), which prints or returns a longer version of the input sentence, by doubling the first word, tripling the second word,

python

Write a function replicate(sentence), which prints or returns a longer version of the input sentence, by doubling the first word, tripling the second word, quadrupling the third word, and so on. For example, replicate('This is a hot day ') produces 'ThisThis isisis aaaa hothothothothot daydaydaydaydayday ', and replicate('0 1 2 3 4 5') produces '00 111 2222 33333 444444 5555555'. The string method split() will help you.

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 Databases Questions!