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 (2016, retired 2019) Slices sillyCase

frank sebring
frank sebring
1,037 Points

The code generates the correct answer but it will not accept my answer as correct. Can someone please tell me why.

I need you to create a new function for me. This one will be named sillycase and it'll take a single string as an argument. sillycase should return the same string but the first half should be lowercased and the second half should be uppercased. For example, with the string "Treehouse", sillycase would return "treeHOUSE".

sillycase.py
def sillycase():
    user_word = input("Type a word in: ")
    user_word2 = user_word.lower()
    user_word3 = list(user_word2)
    size = len(user_word3)
    x = size // 2
    user_word4 = user_word3[x:]
    user_word5 = user_word3[0:x]
    user_word6 = "".join(user_word5) + "".join(user_word4).upper

4 Answers

frank sebring
frank sebring
1,037 Points

Thanks man. I had not paid much attention to return vs print until now. Didn't really understand what the differences were.

frank sebring
frank sebring
1,037 Points

I added the () to the upper and one more line of code.
print(user_word6)

This still shows up as incorrect. If I run it on my computer the program will generate the correct answer.

Also, the challenge never asked for user input. You should be taking in a parameter.