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 Python Collections (2016, retired 2019) Slices sillyCase

Chang Hyeon Lee
Chang Hyeon Lee
2,008 Points

Do I wrong something?

I tested this code by using workspace, it worked but not in challenge.

sillycase.py
def sillycase(string):
    string = 'treehouse'
    do_cased = string[:4]
    up_cased = string[4:]
    return do_cased.lower() + up_cased.upper()
Dave Laffan
Dave Laffan
4,604 Points

If you move

string = 'treehouse'

to the top, outside of your function, it should pass. Otherwise you get a NameError due to the string not already being defined. If not, let me know.