Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
kjksj mnzdmndzf
Python Web Development Techdegree Student 142 PointsPython Challenge Problem
Given a non-empty string like "Code" return a string like "CCoCodCode".
string_splosion('Code') → 'CCoCodCode'
string_splosion('abc') → 'aababc'
string_splosion('ab') → 'aab'
def string_splosion(str) :
blank_string = ' '
for letter in str:
return letter + blank_string
blank_string += str
2 Answers

Steven Parker
224,872 PointsHere's some hints:
- you might want to start with an empty string instead of a space ("blank")
- return after the loop, not inside it
- it might work better to add the new blank_string onto itself and then add the next letter
Where is this from? Please provide a link to the course page if this for a Treehouse course.

Rogerio de Oliveira
Courses Plus Student 21,319 PointsHello Mayank!
To solve this problem I used substring (str[:]). Maybe it would be a little bit advanced, but below a solution for your exercise. Keep your good work!
str = raw_input("enter string: ") result = "" for i in range(1, len(str)+1): result += str[0:i] print(result)
Hope it can help you!
cheers!!
kjksj mnzdmndzf
Python Web Development Techdegree Student 142 Pointskjksj mnzdmndzf
Python Web Development Techdegree Student 142 PointsNo it's not from treehouse.
Steven Parker
224,872 PointsSteven Parker
224,872 PointsFCC?