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! While you're at it, check out some resources Treehouse students have shared here.

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

Python

Kelvin Lim
Kelvin Lim
5,090 Points

My workspace broke ... any way to fix it?

my code:

Kelvin Lim
Kelvin Lim
5,090 Points

def create(): count = 1 while True: with open("file" + count * "y" + ".txt", "w") as file: count += 1 create()

1 Answer

Steven Parker
Steven Parker
231,271 Points

Without Markdown formatting, we can only guess which parts of the code are on separate lines, and which lines are part of the definition. But it looks like perhaps the function calls itself on the last line.

If that's true, it would create a "recursion loop" which would possibly make the workspace seem "broken". Try removing that line.

If that's not it, add formatting to the code so we can get a better look.