You have written an essay for school and it has to be at lea

You have written an essay for school, and it has to be at least five pages long. But your essay is only 4.5 pages long! You decide to use your new Python skills to make your essay longer by spacing out the letters. Write a function that takes a string and a number of spaces to insert between each letter, then print out the resulting string

>>> spaceitout(\"It was a dark and stormy night\",3)

Solution

def spaceitout(str,n):

s=\"\"

for i in range(n):

s=s+\" \"

str.replace(\"\",s)

return str

You have written an essay for school, and it has to be at least five pages long. But your essay is only 4.5 pages long! You decide to use your new Python skills

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site