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 trialKaci Jenkins
860 PointsI give up!
I have asked for help regarding this already, and I have tried it so many different ways, I just have no idea what is wrong or how to fix it.
def sillycase(treehouse):
string = treehouse
word = treehouse
letters = len(word)
numbers = (int(letters))/2
word1 = word[:int(numbers)].lower()
word2 = word[int(numnbers):].upper()
return(word1 + word2)
1 Answer
Andreas cormack
Python Web Development Techdegree Graduate 33,011 PointsHi Kaci
couple of things, you have declared a variable called string but have not used it, if I were you I would stay away from such variable declarations. I think if you indent your return statement the code should work. I have re written your code although it could be refactored to about 3 lines. See below
def sillycase(treehouse):
letters = len(treehouse)
numbers = letters/2
word1 = treehouse[:int(numbers)]
word2 = treehouse[int(numbers):]
return word1.lower()+word2.upper()