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 trialSuresh N
743 PointsCode not running in task window. Runs well in Workspaces
Code not running in task window. Runs well in Workspaces for all kinds of iterables. Any one please help.Thank you.
def first_4(items):
slice1=items[0:4]
return items
2 Answers
Istvan Nonn
2,092 PointsHi Suresh N, It is maybe late night or you are very tired, but you are not returning the right thing from the function.
Also in this case you don't need to introduce a new variable "slice1", you can simply just do:
return items[0:4]
Suresh N
743 PointsAh.. got it . Thank you for the help Istvan Nonn. I am still picking up the concepts :-). Thanks for the tips.