Guest User

Untitled

a guest
Oct 24th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import math
  2.  
  3. p=[]
  4. d=''
  5. def binc(n):
  6. k=0
  7.  
  8. for i in range(n+1):
  9. bin_c=(math.factorial(n))/((math.factorial(k)*(math.factorial(n-k))))
  10. p.append(str(int(bin_c)))
  11. k+=1
  12.  
  13. print(p)
  14.  
  15. binc(6)
  16. def final_formula(list_,m):
  17. k=0
  18. if int(len(list_))%2==1:
  19. l=(int(len(list_)-1)/2)
  20. f=(int(len(list_)-l))
  21. d=list_[-1:(f-1)]
  22. h=list_[1:(f-1)]
  23. while k!=m:
  24. for i in h:
  25. i+'a^{0}b{1}'.format(str(m-k),str(k))
  26.  
  27. k+=1
  28.  
  29.  
  30. final_formula(p,6)
  31.  
  32. for index, value in enumerate(h):
  33. h[index] = '{}a^{}b{}'.format(value, str(m-k), str(k))
Add Comment
Please, Sign In to add comment