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

Tony Joy
Tony Joy
7,031 Points

the code I write in workspaces gives the correct output in the console

when I copy and past the code into the challenges it says...... "did not get correct output from the function name that I am working on. the output comes out fine in workspaces.

sillycase.py
def sillycase(arg1):
    arg_num = int(len(arg1)/2)
    new_arg = arg1[:arg_num] + arg1[arg_num:].upper()
    return new_arg

1 Answer

andren
andren
28,558 Points

Your code uppercases the second part of the string but it does not lowercase the first part of the string. If you add the lower method to your code like this:

def sillycase(arg1):
    arg_num = int(len(arg1)/2)
    new_arg = arg1[:arg_num].lower() + arg1[arg_num:].upper() # Added .lower()
    return new_arg

Then the code will work.