## 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.

# Challenge sillycase, could use some help please!

So I tried it in my IDE of choice and it returns argumMENT however I see if I type a longer word when I call it, it obviously hard coded to stop at 4 maybe that's the mistake I'm not sure.. I even understand this challenge.! could someone help?

sillycase.py
def sillycase(argument):
arg2 = argument.lower()[0:5]
arg3 = argument.upper()[4:]
argument = arg2 + arg3
return argument

The reason that you are having a problem is because you are using a static slicer. So, when you use [0:5] and [4:] it will only slice strings that are of length 8. To build a more dynamic slicer, I built a variable for the first half and the last half. Take a look at this example.

half = int(len(string)/2)
first_half = string[:half].lower()
last_half = string[half:].upper()

I used the length of the string and divided it by two to get half of the message. I then used the int function to change the number from a float to a whole rounded down number. You can then put the variables into the slice itself.

def sillycase(string):
half = int(len(string)/2)
first_half = string[:half].lower()
last_half = string[half:].upper()
return first_half + last_half
'''

Thank you very awesome code :)

this worked for me...

def sillycase(i):
half = int(round(len(i)/2))
low = i[:half].lower()
upp = i[half:].upper()
return (low + upp)