/*If you any query do comment in the comment section else like the solution*/
firstTerm = 1
commonRatio = 2
lastTerm = 1024
sum = 0
while firstTerm <= lastTerm:
print(firstTerm, end=" ")
sum = sum + firstTerm
firstTerm = firstTerm * commonRatio
print()
print("Sum is: {}".format(sum))
Get Answers For Free
Most questions answered within 1 hours.