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

John DiGiovanni
PLUS
John DiGiovanni
Courses Plus Student 902 Points

Excercise solution saying “not finding the correct output”

Hi Treehouse,

My code (attached) in the exercise brings the error that it’s not producing the correct output. However when I test it in Pythonista, it works fine. If ‘treehouse’ is the input the output is ‘treeHOUSE’.

sillycase.py
def sillycase(thing):
    half = len(thing) / 2

    new_1 = thing[int(half):]
    new_2 = thing[:int(half)]

    new = new_2 + new_1.upper()

    return new

2 Answers

AJ Salmon
AJ Salmon
5,675 Points

You need to make sure that all of the letters in the first half are lowercased as well. sillycase('Treehouse') should return treeHOUSE, but with you code it returns TreeHOUSE. Fix that and you'll be good to go :)

John DiGiovanni
PLUS
John DiGiovanni
Courses Plus Student 902 Points

Ah okay! I didn’t know that was a criteria, thank you!

AJ Salmon
AJ Salmon
5,675 Points

My pleasure! Happy coding :)