Question: Write a function star_changer (word), where word is a string. star_changer returns a new string where every other character in word (starting with the
Write a function star_changer (word), where word is a string. star_changer returns a new string where every other character in word (starting with the second character) has been replaced by a certain number of stars (*). The number of stars replacing a character in word should be equal to the index of the character you are replacing. i.e. the character at index 1 would get replaced with 1 star, the character at index 3 with 3 stars, etc. For example: star_changer ("star") should return "s*a***" star_changer ("long word") should return "1*n*** **** *d"
Step by Step Solution
There are 3 Steps involved in it
The solution to the function starchangerword is as follows Python def starchangerword result for i in rangelenword if i 2 0 currentchar wordi numberof... View full answer
Get step-by-step solutions from verified subject matter experts
