1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Eva8 [605]
4 years ago
13

Develop a Python module that will prompt the user for a target sum that is greater than 0 and less than 1 for the following Geom

etric series: Geometric Series Equation The program should first make sure the target sum is within the range specified above. If not, continue to prompt the user for a target sum until it is in the specified range. The program should then compute the Geometric Series until it is greater than or equal to the target sum. The program should output the final sum as well as the number of terms required in the sequence to reach that final sum.
Computers and Technology
1 answer:
marusya05 [52]4 years ago
8 0

Answer:

see explaination

Explanation:

target_sum=float(input("Enter a target sum > 0 and <1 : ")) #asking user to enter the sum

while (target_sum<0 or target_sum>1): #if target sum not in range print the message

print("The target sum is not between 0 and 1")

target_sum=float(input("Please Enter a target sum > 0 and <1 : "))

computed_sum=0.00 #declare computed_sum

term_count=0 #declare term count and initalize to 0

r=1 #variable used to create the difference value

while computed_sum<target_sum: #iterate loop till computed sum is less than target sum

computed_sum=computed_sum+(1/(2**r)) #add previous computed sum with current term (1/2,1/4,1/8 etc)

term_count+=1 #increment term count

r+=1 #increment r value

print("Final Sum = " ,computed_sum) #finally print term count and final sum

print("Number of Terms= " ,term_count)

You might be interested in
Which of the following best meets the requirements of a strong password?
Hoochie [10]

Answer:

having a capital and lower case letters and a special characters and numbers.

Explanation:

it should be hard but easy enough to remember and no one will know

6 0
3 years ago
Read 2 more answers
An engine that generates hot, expanding gases by burning fuel inside the machine.
Keith_Richards [23]

Answer:

Piston engines, jet engines, and rocket engines all depend on the same basic principles to produce thrust. The engine mixes fuel with oxygen or another oxidizer in a combustion chamber. The mixture is ignited. The burning mixture creates hot, expanding gases.

Explanation:

PA BRAINLIEST

3 0
3 years ago
Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the
Aloiza [94]

Answer:

Following are the code to the given question:

try//defining a try block

{

processor.process();//defining an object processor that calls process method

}

catch(Exception e)//defining a catch block

{

}

Explanation:

In this question, the 'Try' and 'catch' block is used in which both the keywords are used to represent exceptions managed during runtime due to information or code errors. This try box was its code block which includes errors. A message queue catches the block errors and examines these.

In the try block, a method "process" is used which is create the object processor that calls the method.

5 0
3 years ago
Which agricultural CTSO has programs for middle-school and high-school students, as well as college students?
Airida [17]
National FFA is the answer to your question my guy.
4 0
4 years ago
Read 2 more answers
Which of the following circuits has an equivalent resistance of 30 Ω?
zimovet [89]

Answer:

the one on the bottom left

Explanation:

10+20=30

The other 20 does not matter. electricity takes one path, always the path with less resistance but here there both the same.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Cd-roms typically use the _______ filesystem type.
    11·1 answer
  • Write a program to print the area of a rectangle by creating a class named 'Area' having two methods. First method named as 'set
    6·1 answer
  • Why a commerce student must learn about SDLC (Software Development Life Cycle) and its phases?
    12·1 answer
  • What’s an input Device
    7·2 answers
  • 10. Question<br> What are the drawbacks of purchasing something online? Check all that apply.
    5·1 answer
  • Multiple Choice
    7·1 answer
  • Which of these is an example of input?
    6·1 answer
  • Ple Choice Worth 5 points)
    11·1 answer
  • if you put a drone on the charger at 8:12 and take a break at 10:03 how long is it on the charger. for
    7·1 answer
  • Variables that can take only 2 variables are referred to as which one of the following?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!