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 trial

Python Python Collections (2016, retired 2019) Slices sillyCase

Ashley Keeling
Ashley Keeling
11,476 Points

I don't know how to do this question

it says

Bummer! Be sure to use integers for indexes. int() or // will be needed!

sillycase.py
def sillycase(st):
    x=list(st)
    y=x/2
    return str[ :y].lower() + str[y:].upper()

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

While adding the second division slash is important, there are a few more errors

  • in calculating y, you need to use the len(x) instead of x
  • in the return statement, the built-in function str should be the parameter st instead

Post back if you need more help. Good luck!!!

Ashley Keeling
Ashley Keeling
11,476 Points

THANKS I completed the challenge thanks for the help

Steven Parker
Steven Parker
231,236 Points

Division generates floats by default, but the "//" operator is the special "integer division" operator:

    y=x//2

And as the challenge hinted, you could also pass the entire expression as the argument to "int()".

Ashley Keeling
Ashley Keeling
11,476 Points

I have put two divide symbols in, and it still says the same thing