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

Ong Jia Rui
Ong Jia Rui
1,731 Points

Weird Error

Bummer! HeMGIUPhpaNuftcWKYXTGJDYSSQMOVBKANZ;;;hemgiuphpanuftcwkYXTGJDYSSQMOVBKANZ Restart

sillycase.py
def sillycase(word):
    mid = int(len(word)/2)
    new_word = [0, 1]
    new_word[0] = word[:mid-1]
    new_word[1] = (word[mid-1:]).upper()
    return "".join(new_word)
Steven Parker
Steven Parker
231,236 Points

You might want to report that one to Support.

I think the string before the semi-colons is what your function is producing and the string after is what it's expecting.

I'll let the staff know that it's not formatted properly.

The error message has been fixed. It will now read "Didn't get the right output from sillycase." for the code that you have.

2 Answers

Andrew Voitsekhovskyy
Andrew Voitsekhovskyy
3,523 Points

Firstly try

mid = int(len(word)/2.0)

Hi Ong Jia Rui ,

Try tracing through your code with the example "Treehouse" string and see if you get the expected result of "treeHOUSE"

See if you're slicing at the correct index.

Also, you're upper-casing the second half but what about the first half?