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 trialAlejandro Loja
6,541 PointsI have been stuck on this problem for 30 mins, what am I doing wrong?
Thanks in advance
import random
def get_locations(cells):
pass
for i in range(cells.length):
value = random.sample(cells,3)
return value
1 Answer
Umesh Ravji
42,386 PointsHi Alejandro, you actually have the code you need, but you need to remove the loop (and the pass) :)
Just for future reference, indentation is extremely important in python, for your loop to be within your function, it would have to be indented.
def get_locations(cells):
value = random.sample(cells, 3)
return value
ilya A
3,802 Pointsilya A
3,802 Pointswhy did the problem include "pass" that you have to remove after the first line of your code?