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 trialaa114
1,697 Pointskenneth love challenege
Challenge Task 1 of 1 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\".
Don't worry about rounding your halves, but remember that indexes should be integers. You'll want to use the int() function or integer division, //."
i couldnt solve this! help
def sillycase(argument):
return argument
3 Answers
Steven Parker
231,236 PointsHere's some hints that my help:
- the integer division mentioned would be useful for finding half of the length
- a "slice" would be a way to get the first (or last) part of a string
- there are functions that change the case of a string
- parts of a string can be (re)joined by concatenation (the "+" operator)
If you're still stuck, you might take a look at some of the answers to previous questions asked about the same exercise.
mersadajan
21,306 PointsFirst divide the string into two halves. Put each halve in a variable. Put the first string into lower case and the second string into uppercase. Return the concatenated string. I am not sure if this is going to far in regards to "helping"
ERDAL DINCER
1,635 Pointssillycase=['Treehouse'] len=len(sillycase) sillycase=sillycase.upper(0:(len/2+1)+sillycase.lower(len/2::)
What is wrong with this coding ?
Steven Parker
231,236 PointsSee the comments in this other question where you posted the same thing.
And remember to start a fresh question next time.