Python Python Collections (2016, retired 2019) Slices sillyCase

zoltans
zoltans
1,582 Points

sillycase task got me mad.

when I run this in Workspaces it returns the right result. but not on the actual task page.

def sillycase(string):

    half = int(len(string) // 2)
    print(string.lower()[0:half] + string.upper()[half:])




sillycase("apple")

I need some help please!

sillycase.py
def sillycase(string):
    half = len(string) // 2
    print(string.lower()[0:half] + string.upper()[half:])

1 Answer

Steven Parker
Steven Parker
171,314 Points

You're really close, but the instructions said "sillycase should return the ... string", and while this code computes it properly, it doesn't return anything.

For the challenge, you won't need to "print" anything, but you do need to return the result.

zoltans
zoltans
1,582 Points

Oh, what a relief! :) Thanks a lot Steven!