Advertisement
here2share

# full_bell_curve.py

Oct 19th, 2022
1,230
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 1 0
  1. # full_bell_curve.py
  2.  
  3. from math import sin, pi
  4.  
  5. def bell(height=25,steps=99,floats=False):
  6.     t = []
  7.     ttt = []
  8.     j = 180.0 / steps
  9.     def iii(x):
  10.         ttt.append(x)
  11.         return int(x)
  12.     def fff(x):
  13.         ttt.append(x)
  14.         return x
  15.     if floats:
  16.         o = fff
  17.     else:
  18.         o = iii
  19.    
  20.     for k in range(steps):
  21.         x = sin((j*k)*pi/180) * height
  22.         if x in ttt:
  23.             t.pop()
  24.             while len(t) > steps/2:
  25.                 t.pop()
  26.             t += [o(25.0)]
  27.             return [o(0.0)]+t[1:-1]+t[::-1]
  28.         else:
  29.             t += [o(x)]
  30.            
  31. print (bell()) # ...or ever print (bell(floats=1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement