Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # full_bell_curve.py
- from math import sin, pi
- def bell(height=25,steps=99,floats=False):
- t = []
- ttt = []
- j = 180.0 / steps
- def iii(x):
- ttt.append(x)
- return int(x)
- def fff(x):
- ttt.append(x)
- return x
- if floats:
- o = fff
- else:
- o = iii
- for k in range(steps):
- x = sin((j*k)*pi/180) * height
- if x in ttt:
- t.pop()
- while len(t) > steps/2:
- t.pop()
- t += [o(25.0)]
- return [o(0.0)]+t[1:-1]+t[::-1]
- else:
- t += [o(x)]
- print (bell()) # ...or ever print (bell(floats=1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement