human
Sum of an Infinite Geometric Progression ( GP ) | Function to calculate the sum of an infinite Geometric Progression.
Case for Infinite Sum.
Store the sum of GP Series.
Print the value of sum.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to sum of an Infinite Geometric Progression ( GP ) and the other steps required.
 def findSumOfGP ( a , r ) :
	if ( abs ( r ) >= 1 ) :
		print ( " Infinite " )
		return
	sum = a / ( 1 - r )
	print ( int ( sum ) )
if __name__ == ' _ _ main _ _ ' :
	A , R = 1 , 0.5
	findSumOfGP ( A , R )