Python Python Collections (2016, retired 2019) Slices sillyCase

Andrew Li
Andrew Li
3,321 Points

I think I solved this but got an error back? " Be sure to use integers for indexes. `int()` or `//` will be needed!"

I tested this but it seems to be working but i got an error back?

sillycase.py
def sillycase(word):
    first_half = len(word)/2
    first_half_slice = word[:first_half].lower()

    second_half = len(word)-first_half
    second_half_slice = word[-second_half:].upper()

    return first_half_slice + second_half_slice

1 Answer

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 52,004 Points

This:

first_half = len(word)/2

needs to be an integer. Try

first_half = int(len(word)/2)
Andrew Li
Andrew Li
3,321 Points

Awesome! Thank you but howcome I failed the first time? Is it because it specifically asked for me to turn into an int?

Thanks again 😁