
Patrick B. answered 07/12/21
Math and computer tutor/teacher
import random
nSteps = -1
while (int(nSteps)<0):
nSteps = input("How many steps ??? :>")
xCurPos=0
yCurPos=0
for iLoop in range(int(nSteps)):
nRandInt = random.randint(1,100)
if (nRandInt<=50):
xCurPos = xCurPos+1
else:
xCurPos = xCurPos-1
nRandInt = random.randint(1,100)
if (nRandInt<=50):
yCurPos = yCurPos+1
else:
yCurPos = yCurPos-1
print(" cur position at (" + str(xCurPos) + "," + str(yCurPos) + ")")

Patrick B.
Desmos dot com07/13/21
Marie D.
thanks for your great help! how about plotting using matplotlib or any plotting means?07/12/21