Dont understand Python Method
Posted
by
user836087
on Stack Overflow
See other posts from Stack Overflow
or by user836087
Published on 2012-11-11T16:49:09Z
Indexed on
2012/11/11
17:00 UTC
Read the original article
Hit count: 516
python
|artificial-intelligence
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)
© Stack Overflow or respective owner