Advertisement
Fhernd

parcial1.py

Mar 20th, 2019
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. -- Punto 1:
  2.  
  3. from random import random
  4. from matplotlib import pyplot
  5.  
  6. caminata = []
  7. caminata.append(0)
  8.  
  9. for i in range(1, 1000):
  10.     desplazamiento = -1 if random() < 0.5 else 1
  11.    
  12.     caminata.append(caminata[i - 1] + desplazamiento)
  13.    
  14. pyplot.plot(caminata)
  15. pyplot.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement