×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Lucas Series Vowel count in String
Custom Series Print - Python Language
1370    Arnab De    15/10/2020

Write the Python code to generate the terms of the following series up to n terms (n is user input) using a for loop and find the sum of the terms of the series [you should print the terms of the series exactly as shown below]:
S = 1/(4*5) – 1/(6*10) + 1/(8*20) – 1/(10*40) … up to n terms

softetechnologies
N=int(input("Enter Terms : "))
p=S =""
n=4
d=5
for i in range(1,N+1):
    if i==1:
        p=p + "1/(" + str(n) + "*" + str(d) + ")"
    elif i%2==0:
        p=p + "-1/(" + str(n) + "*" + str(d) + ")"
    else:
        p=p + "+1/(" + str(n) + "*" + str(d) + ")"
    n=n+2
    d=d*2
print(p)        

softetechnologies
Lucas Series Vowel count in String
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Swami Vivekananda
Truth can be stated in a thousand different ways, yet each one can be true.
Swami Vivekananda
1133
64.31
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     47404
25/06/2018     39491
01/01/2018     39105
28/06/2017     37000
02/08/2017     35725
01/08/2017     29962
06/07/2017     29748
15/05/2017     29229
14/07/2017     25118
11/09/2018     24261
softetechnologies