Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Magic
- 1) x, 2) x + 11, 3) x + 6, 4) x^2 + 6x, 5) x^2 + 6x + 9, 6) x + 3, 7) x + 4, 8) x
- '''
- from math import sqrt
- from matplotlib import pyplot as plt
- def magic(number):
- results = list()
- results.append(number) # 1
- results.append(results[0] + 11) # 2
- results.append(results[1] - 5) # 3
- results.append(results[2] * results[0]) # 4
- results.append(results[3] + 9) # 5
- results.append(int(sqrt(results[4]))) # 6
- results.append(results[5] + 1) # 7
- results.append(results[6] - results[0]) # 8
- return results
- # MAIN FUNCTION
- numbers = list(range(1, 101))
- magics = list()
- for number in numbers:
- magics.append(magic(number))
- for magic in magics:
- plt.plot(magic)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement