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

MONIQUE PORTILLO
MONIQUE PORTILLO
172 Points

Some help would be fine here, thank you! I dont know what I am doing wrong here

I run the same syntax in my terminal and it returns "treeHOUSE", but I still can't get through this challenge.

challenge: I need you to create a new function for me.

This one will be named sillycase and it'll take a single string as an argument.

sillycase should return the same string but the first half should be lowercased and the second half should be uppercased.

For example, with the string "Treehouse", sillycase would return "treeHOUSE".

Don't worry about rounding your halves, but remember that indexes should be integers. You'll want to use the int() function or integer division, //.

code: [alt text]https://w.trhou.se/usg2yq3imv

sillycase.py
def sillycase('treehouse'):
    lowered_case = string[0:4:].lower()
    uppered_case = string[4:11:].upper()
    return lowered_case + uppered_case

1 Answer

Steven Parker
Steven Parker
231,275 Points

Your function should work with any string of any size, not just the one shown in the example (or one the same size).

Also, parameter names should not be enclosed in quotes, and should be the same as the name used inside the function.

MONIQUE PORTILLO
MONIQUE PORTILLO
172 Points

I didnt mean to post that picture, but thanks for the hint.