Dont understand Python Method
- by user836087
I dont understand what is going on in the move method. I am taking the AI course from Udacity.com. The video location is: http://www.udacity.com/view#Course/cs373/CourseRev/apr2012/Unit/512001/Nugget/480015
Below is the code I dont get, its not working as shown in the video ..
The answer I should be getting according to Udacity is [0, 0, 1, 0, 0]
Here is what I get []
p=[0, 1, 0, 0, 0]
def move(p, U):
q = []
for i in range(len(p)):
q.append(p[(i-U) % len(p)])
return q
print move(p, 1)