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

Ivan K
Ivan K
1,928 Points

Hi all, I done that excersice, but faces with error when I try to execute script in your site

Hi, in my Terminal it works cool, but in your web site environment I faced with error when try to execute it regarding "sillycase" task.

def sillycase(): word = 'Treehouse' a = (word[0:int(len(word)/2):1]) b = (word[-int(len(word)/2)::1]).upper() print(a+b) sillycase()

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 = 'Treehouse'
    a = (word[0:int(len(word)/2):1])
    b = (word[-int(len(word)/2)::1]).upper()
    print(a+b)
sillycase()

2 Answers

Two things that might've confused you:

  • The code challenge automatically calls the function. It just causes an error in the code challenge if you do so :)
  • Also, your function is actually just returning None, and it's not the thing you expect the function to return. This is because you printed the output, and didn't return it :smile:

To fix these, do these steps:

  1. Get rid of the sillycase() line of code (the line where you call the function)
  2. Change print(a+b) to return a+b.

Good luck! ~alex

Ivan K
Ivan K
1,928 Points

thanks!

Your welcome! Can you give me a Best Answer so others in the Community know this is answered? Thank you very much! ~alex

Hi Alexander,

It's a good idea to run through the challenge with your suggested fixes to make sure it's correct.

I don't know if you'd like to check the challenge again and revise your answer but there are more things wrong with the original code.

Oh yeah. Code challenges are broken for me, so sadly I can't check...

What do you mean? You can't access any code challenge?

Have you emailed support about this?

Yep. I can't access any code challenge, but I think it's because I'm using Ubuntu.

Rob Allessi
Rob Allessi
8,600 Points

Hey Alexander Davison would you please email us at help@teamtreehouse.com with a description of the issue you are facing when you attempt to access a code challenge? Screenshots would be very helpful as well.