Python Python Collections (2016, retired 2019) Slices sillyCase

Rohan Tinna
Rohan Tinna
2,885 Points

Sillicase Python Problem

Unable to solve this code challenge.

sillycase.py
def sillycase(text):
    mid = (len(text) // 2) - 1
    new_text[:mid] = text[:mid].tolower()
    new_text.join(text[mid:].toupper())
    return new_text
rydavim
rydavim
Treehouse Moderator 16,630 Points

Steven Parker has some fantastic hints below, but let us know if you're still feeling stuck. Happy coding!

1 Answer

Steven Parker
Steven Parker
171,227 Points

Here's a few hints:

  • you won't need to subtract one for the half
  • you cannot assign into a slice
  • you will need both a lower-cased part and an upper-cased part
  • the "join" operator uses the string on the left as a separator, not one of the components to join
  • you can also combine strings with concatenation, which may be easier in this case