Skip to content

Instantly share code, notes, and snippets.

@BlogBlocks
Last active December 19, 2017 00:31
Show Gist options
  • Save BlogBlocks/9fd662ee3d12a26decf0459da80601e3 to your computer and use it in GitHub Desktop.
Save BlogBlocks/9fd662ee3d12a26decf0459da80601e3 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
"""
Just playing with randint, lists and plots
Created for Jupyter Notebook
Useage:
import ToyPlot
ToyPlot.toyplot()
"""
import matplotlib.pyplot as plt
from random import randint
def toyplot():
# Creates an empty list
data = []
# Initiates variable x
x = 1
#picks a random range for the Graph
rang = randint(20,200)
# Starts a loop from the variable x to the randomly picked range
while x < rang:
# Gets a random number ranging from x to the range and asigning it to a variable dataI
# notice the randint range decreases as the variable x increases
dataI = randint(x, rang)
#apending the list ' data[] '
data.append(dataI)
# adding one count to x
x=x+1
# After all data is created Plot it
plt.plot(data)
plt.ylabel('Random Range')
plt.show()
if __name__ == "__main__":
toyplot()
@BlogBlocks
Copy link
Author

made public

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment