Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Collections (Retired) Slices sillyCase

Paul Heneghan
Paul Heneghan
14,340 Points

If I run this code outside of a function, it works. But as a function it doesn't return anything when called.

myString = "Treehouse" def sillycase(myString): lower_silly = myString[0:round(len(myString)/2)].lower() upper_silly = myString[round(len(myString)/2):].upper() print(lower_silly + upper_silly)

sillycase(myString)

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"
myString = "Treehouse"
def sillycase(myString):
    lower_silly = myString[0:round(len(myString)/2)].lower()
    upper_silly = myString[round(len(myString)/2):].upper()
    print(lower_silly + upper_silly)

sillycase(myString)

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

You are 100% correct. It doesn't return anything. It prints the result :smiley: If I copy/paste your code, and change the print to the word return, the challenge passes! :sparkles:

Paul Heneghan
Paul Heneghan
14,340 Points

How loud can I say it? D'oh!

Thank you so much, JN!