Python Python Collections (2016, retired 2019) Slices sillyCase

Rohan Tinna
Rohan Tinna
3,370 Points

Sillicase Python Problem

Unable to solve this code challenge.
def sillycase(text):
    mid = (len(text) // 2) - 1
    new_text[:mid] = text[:mid].tolower()
    return new_text
18,756 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
207,972 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