Advertisement
Peaser

Sequence demo

Apr 8th, 2015
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. def sequence_1():
  2.     th = []
  3.     for i in range(10):
  4.         th.append(i)
  5.         print i+sum(th)
  6.  
  7. def sequence_2():
  8.     a = lambda n: (((n-1)*(n+2))/2)
  9.     for i in range(1, 11):
  10.         print a(i)
  11.  
  12. #print the same things
  13.  
  14. sequence_1()
  15. sequence_2()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement