Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
221,900 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
221,900 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.