InterviewSolution
Saved Bookmarks
| 1. |
Write Python script to calculate sum of following series :s = (1) + (1+2) + (1+2+3) +…+ (1+2+3+…+n) |
|
Answer» sum 0 n = int (raw_input (“Enter the value of n :”)] for a in range (2, n+2): term = 0 for b in range (1,1): term + = b print “Term”, (a-1), “:”,term sum + = term print “Sum of”, n, “term is”, sum |
|