Python Lab 12 @333
Python Lab 12 @333
Pre Lab 05
Program 10
Post Lab 05
Output Verification 15
Viva 05
Total 40
REPORT VERIFICATION
Program:
import numpy as np
import matplotlib.pyplot as plt
def Randwalk(n):
x = 0
y = 0
time = [x]
position = [y]
time.append(x)
position.append(y)
return [time,position]
Randwalk1 = Randwalk(1000)
Randwalk2 = Randwalk(1000)
Randwalk3 = Randwalk(1000)
plt.plot(Randwalk1[0],Randwalk1[1],'r-', label = "Randwalk1")
plt.plot(Randwalk2[0],Randwalk2[1],'g-', label = "Randwalk2")
plt.plot(Randwalk3[0],Randwalk3[1],'b-', label = "Randwalk3")
plt.title("1-D Random Walks")
plt.legend(loc='upper center', bbox_to_anchor=(0.5,-0.1),
fancybox=True, shadow=True)
plt.show()
Output:
PRE-LAB
1) Define import random ? How do you do Random walk?
POST LAB
1) Statement of the output of the following Python code is either 1 or 2 ?