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 trialTravis John Villanueva
5,052 PointsHelp with the proper output? What is the desired outcome?
I think i nailed this objective as ive test it in worskpaces. It was previously as
def x(raw): raw=list(raw) print(raw[:4])
but im making a wild guess now that is why its 3.
What is the desired output?
def first_4(raw):
raw=list(raw)
print(raw[:3])
1 Answer
Grace Kelly
33,990 PointsHi Travis, you're almost there! Just a couple of minor things:
- To get the first 4 items in a list you use
[:4]
which goes from index 0 and moves 4 places. - The challenge requires to return the result, not to print it :)
Hope that helps!!