Horje
python program for geometric progression Code Example
geometric progression in python
def geometric_progression(a1, n, q):
    print(a1)
    for i in range(1, n + 1):
        power = i - 1
        t = a1 * q ** power
        print(t)
python program for geometric progression
#sum of terms in geometric proggression in python
x=int(input('Enter the value of x :'))
n=int(input('Enter the value of n :'))
total=1
for i in range(1,n+1):
  s=x**i
  total+=s
  print('term',i,'is',s)
print('The sum of the series 1+x+x2+x3+....+xn=',total)
#Output
Enter the value of x :2
Enter the value of n :4
term 1 is 2
term 2 is 4
term 3 is 8
term 4 is 16
The sum of the series 1+x+x2+x3+....+xn= 31




Python

Related
python class get attribute by name Code Example python class get attribute by name Code Example
how to maker loops coun t in second in pytho Code Example how to maker loops coun t in second in pytho Code Example
DJANGO rest framework GET POST Code Example DJANGO rest framework GET POST Code Example
python alfabet Code Example python alfabet Code Example
python program to print list vertically without using loop Code Example python program to print list vertically without using loop Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8