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 Back and Forth

zheshuozhang
PLUS
zheshuozhang
Courses Plus Student 820 Points

name 'slice1' is not defined

I tested this code in PyCharm it works but why there still has an error about name 'slice1' is not defined?

slices.py
favorite_things = ['raindrops on roses', 'whiskers on kittens', 'bright copper kettles',
                   'warm woolen mittens', 'bright paper packages tied up with string',
                   'cream colored ponies', 'crisp apple strudels']

slicel = favorite_things
slicel[1:4]

print(slicel)

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, zheshuozhang ! You're doing great and this won't pass even when you fix this part, but this will get you headed in the right direction. The challenge is asking for a variable named slice1. That can be read aloud as "slice one". But you've declared a variable named slicel which can be read aloud as "slice L". You've typed a lowercase "L" where you were meant to type the digit one (1). I know the font is really close which is the cause of this particular mix up.

Hope this helps! :sparkles: