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

Al3n MicL
Al3n MicL
6,364 Points

sillycase challenge: what's wrong with my solution?

Ok, so I tried to follow each step methodically, when I get to the return portion it throws error:

Bummer! unsupported operand type(s) for +: 'builtin_function_or_method' and 'builtin_function_or_method'

Do I have to convert the strings to a list first and then join them?

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(str):
  half = round(len(str) / 2)  
  first = str[:half]
  last = str[half:]
  return first.lower + last.upper
#sillycase('Kenneth')

1 Answer

Dan Johnson
Dan Johnson
40,532 Points

Since lower and upper are methods, you'll want to add parentheses at the end to call them:

return first.lower() + last.upper()

This will add what the methods return rather than attempt to add the methods themselves together.

Al3n MicL
Al3n MicL
6,364 Points

Yep, it was the parenthesis. Can't believe I forgot them. I guess I made a 'silly' mistake... j/k

Thanks Dan!