Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

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)
Comment

PREVIOUS NEXT
Code Example
Python :: receipt ocr python 
Python :: printing hello world in python 
Python :: nested python list 
Python :: python if else interview questions 
Python :: socket for api in django 
Python :: print something python 
Python :: negate an int in python 
Python :: import messages 
Python :: python infinite loop 
Python :: functional conflict definition 
Python :: how to find the shortest word in a list python 
Python :: class views django slug 
Python :: print backwards python 
Python :: value_counts sort by index 
Python :: python3 vowels and consonants filter 
Python :: how to make take command in python 
Python :: how to give values to all users with discord api python grepper 
Python :: how to make a time limit using renpy 
Python :: file = Root() path = file.fileDialog() print("PATH = ", path) 
Python :: 12 hour clock to 24 hour clock in python 
Python :: how to navigate to a sub html script selenium python 
Shell :: restart audio ubuntu 
Shell :: how to install scikit learn python library 
Shell :: ubuntu extract rar 
Shell :: upgrade pandas version 
Shell :: remove all the containers docker 
Shell :: install xdotool ubuntu 
Shell :: undo git 
Shell :: how to uninstall create-react-app 
Shell :: download filezilla in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =