Last active
December 19, 2017 00:31
-
-
Save BlogBlocks/9fd662ee3d12a26decf0459da80601e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
made public