
- 22 students
- 41 lessons
- 0 quizzes
- 10 week duration
-
Python Basics
- Installing Anaconda and running a sample Python Program
- How to use the Print function in Python?
- Arithmetic Operations in Python
- Running a Web Server using Python in Spyder
- Input Output in Python
- Starting Plots in Python
- For loop in Python
- Installing and running DJango
- Linear and Polynomial Regression using Python
- Some Problems on Lists
- Creating Classes in Python
- Inheritance in Python
- How to implement Multiple Inheritance in Python
- Using Flask-1
- Lists in Python
- Lists in Python — 1
- Sorting of Lists
- Lists in Python — Insertions
- How to make a list in python and save it in files ……
- Importing Excel Files in Python
- Mailer in Python
- How to add a simple view to a Django site?
- Python Print and I/O questions
- Print answers
- If then else in Python
- Summation of Series
- Python Print Assignment
- Loop Assignments
- Pickle in Python
- Dictionary in Python-1
- Dictionaries in Python-2
- Python OOPs Assignment
- Operator Overloading in Python
- Equation Solving using Numpy
- Starting Numpy
- Passing Data from a Python Controller to a HTML Page
- Downloading Data from a URL in Python
- Sending a Dictionary to a HTML Template and displaying it using Flask.
- Web Scraping Library-1
- Downloading data from a remote website and displaying data in an html page
- Arithmetic Operations in Python — Assignment
Summation of Series
To sum the series 1+2+3+4+… +n
#sum from 1 to n
n=10
sum=0
for i in range(1,n+1):
—sum=sum+i
print(“Sum from {0} to {1} is {2}”.format(1,n,sum))
Ans 55
To sum a series from a to b
#sum from a to b
a=5
b=7
sum=0
for i in range(a,b+1):
—sum=sum+i
print(“Sum from {0} to {1} is {2}”.format(a,b,sum))
Ans 18
To sum the series 1,-2,3,-4,5,-6,…-10. Alternately positive and negative
# 1,-2,3,-4,5,-6,…-10
a=1
b=10
t=1
sum=0
for i in range(a,b+1):
—x=t*i
—sum=sum+x
—print(x,end=”,”)
—t=-t
print(“\nSum from {0} to {1} is {2}”.format(a,b,sum))
To sum the series 1! + 2! + 3! + 4! + 5!
#To sum the series 1! + 2! + 3! + 4! + 5!
a=1
b=5
f=1
sum=0
for i in range(a,b+1):
—f=f*i
—sum=sum+f
—print(f,end=”,”)
print(“\nSum from fact({0}) to fact({1}) is {2}”.format(a,b,sum))
To sum the sine series x-x^3/3!+x^5/5!-x^7/7!+….
#To sum the sine series x-x^3/3!+x^5/5!-x^7/7!+….
a=1
b=10
angle=30
x=angle*3.1415927/180
sum=0
term=x
for i in range(a,b+1):
—sum=sum+term
—term=-term*x*x/(2*i*(2*i+1))
print(“\nSine of({0}) is {1}”.format(angle,sum))
Try the following problems
- Sum the cosine series
- Find the sum of 1*2 + 2*3 + 3*4 ,…..
- Find the sum of 1/1 + 1/2 + 1/3 + 1/4…..