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

Abdulkadir Kollere
Abdulkadir Kollere
1,723 Points

Bummer! scnGPJDVHILQABF;;;scngpjdVHILQABF

I need help with this part please. I dont know what the error means and I dont see any issue with the code. Anyone for the rescue?

sillycase.py
def sillycase(iterable):
    one = iterable[:3]
    one = one.lower()
    two = iterable[3:]
    two = two.upper()
    total = one + two
    return total

2 Answers

You need the function to be dynamic and work with the length. For instance:

def sillycase(word):
    half = int((len(word))/2) # Diving by two will return a float value - Slicing requires an int
    first = word[:half].lower()
    second = word[half:].upper()
    return first+second

changed from comment to answer

Abdulkadir Kollere

You can mark the question as answered now if you want.

Abdulkadir Kollere
Abdulkadir Kollere
1,723 Points

Thanks Seth. There is no option to mark the question as answered.