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

Michael Morale
Michael Morale
2,702 Points

sillycase

I'm still stuck on this. Any ideas?

sillycase.py
def sillycase(word):
    word = apples
    halfway = (len(word) // 2)
    word.lower([0:halfway])
    word.upper([halfway:])
    return(word)

1 Answer

Steven Parker
Steven Parker
231,272 Points

You're close, but you don't want to overwrite the argument right at the beginning. Plus, nothing named "apples" has been defined.

Also, your slice syntax isn't quite right. The brackets with slice parameters need to come after the string they apply to instead of being inside the parentheses of the method call. Those methods don't take arguments anyway.

Then, you'll need to save those slices where you can combine and return them, or make them be part of the return statement directly.

Michael Morale
Michael Morale
2,702 Points

I got it! This is what I did:

def sillycase(word):
        halfway = len(word) // 2
        final_word = word[0:halfway].upper() + word[halfway:].lower()
        return final_word