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

George Lugo
seal-mask
.a{fill-rule:evenodd;}techdegree
George Lugo
Python Web Development Techdegree Student 922 Points

why isn't my code working

def sillycase(string): Dot = int(len(string / 2)) josh = string[:Dot] alison = string[Dot:] return josh.lower() + alison.upper()

sillycase.py
def sillycase(string):
    Dot = int(len(string / 2))
    josh = string[:Dot]
    alison = string[Dot:]
    return josh.lower() + alison.upper()

1 Answer

your code is OK just change this:

    Dot = int(len(string / 2))

to this:

    Dot = int(len(string) / 2)

len() returns the length of the string, this then should be devided by 2. What your doing is deviding the string by two and this is not allowed.

And note that it is bad practice using variable names which start with an uppercase