Python Python Collections Slices sillyCase

kenneth 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

2 Answers

Steven Parker
Steven Parker
168,137 Points

Here'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.

6,248 Points

First 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"