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 (Retired) Slices sillyCase

help with sillycase task

I've tried so many ways of structuring this and can't pass it. seems like it should work from the study I've done with the interpretor.

silly.py
# The first half of the string, rounded with round(), should be lowercased.
# The second half should be uppercased.
# E.g. "Treehouse" should come back as "treeHOUSE"
def sillycase(word):
  word = "Treehouse"
  half = round(len(word) /2)
  new_word = word.lower[:half] + word.upper[half:]

you are not very far. why don't you remove the second line from your code, its not necessary. secondly the .lower and .upper functions should come after the slice. then return the word this one worked for me def sillycase(word) half = round(len(word)/2) return word[:half].lower() + word[half:].upper()

Thanks Dephine! I was so close and it was working in the interpreter but I guess I just wasn't understanding the instructions fully.

1 Answer

you are not very far. why don't you remove the second line from your code, its not necessary. secondly the .lower and .upper functions should come after the slice, don't forget the parathesis. then return the word, this one worked for me def sillycase(word): half = round(len(word)/2) return word[:half].lower() + word[half:].upper()