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

Lucas Frischmann
Lucas Frischmann
1,397 Points

Why do I get still a Bummer! Error? count = len(name)-1 first_half = count/2 def sillycase(): f

name = 'Treehouse'

count = len(name)-1 first_half = count/2

def sillycase(): first = name[0:first_half].lower() second = name[first_half:99].upper() return first + second print sillycase()

sillycase.py
name = 'Treehouse'

count = len(name)-1
first_half = count/2

def sillycase():
    first = name[0:first_half].lower()
    second = name[first_half:99].upper()
    return first + second
print sillycase()

2 Answers

Steven Parker
Steven Parker
231,236 Points

You're close, but here's a few hints:

  • you forgot to indicate name as a parameter (inside the parentheses of the definition)
  • your calculations of count and first_half should be done inside the function
  • to be used as an index, you must make sure first_half is an integer
  • you won't need to establish a test string, the challenge will pass it to you
  • you don't need to print anything
Lucas Frischmann
Lucas Frischmann
1,397 Points

Thanks Steven that make sense! But is there a difference between Python 2 and Python 3? In Jupyter Notebook is working fine! THX again!

Steven Parker
Steven Parker
231,236 Points

Yes, there are several syntax differences between Python version 2 and 3. I'd recommend sticking with Python 3 while you're learning to avoid confusion.