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 trialKate Dougherty
8,334 PointsSillycase challenge
So I saw the related solution at https://teamtreehouse.com/community/is-there-a-different-approach-to-solving-this-challenge and realized I did this in a very roundabout way, but I do get the correct result when I run it in the Python shell in my Terminal (I tried a couple different strings). Is there a reason why this Treehouse isn't accepting this? Thanks.
def sillycase(input):
length = len(input)
numbers = range(0, length)
index_length = int(len(numbers)) - 1
print index_length
first_half = input[0:index_length // 2].lower()
second_half = input[index_length // 2:].upper()
print first_half + second_half
sillycase("Treehouse")
josephr
18,877 PointsAssuming you are getting the correct output elsewhere, I assume the problem is that your function prints instead of returns.
1 Answer
Kate Dougherty
8,334 PointsThat was it, Joseph R. Thank you!
Kate Dougherty
8,334 PointsKate Dougherty
8,334 PointsThis isn't working for Treehouse either (but it is in Terminal):
def sillycase(input): half = len(input) // 2
sillycase("Treehouse")