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
A _______ attack is where the input includes code that is then executed by the attacked system.
sweet [91]

Answer: Code injection

Explanation:

3 0
2 years ago
Siva added a Contact Form to her website. This is used for the collection to be included in
MAVERICK [17]
This helps people to ask questions or report if something wrong happens but yeah it can be included in the profile collection.hope this helps.
4 0
4 years ago
Encapsulate the following Python code from Section 7.5 in a function called my_sqrt that takes a as a parameter, chooses a start
Elden [556K]

Answer:

def my_sqrt(a):

   while True:

       x = a

       y = (x + a / x) / 2

       if (y == x):

           break

       else:

           x = y

   print(x)

   return 0

my_sqrt(5)

Explanation:

The above is a function in Python, and the exact copy as code of what is being given in the question. Its a method to find out the square root of a number which is a here. The while loop has been used as being mentioned in the question, and the variables are defined and calculated as being stated.

3 0
3 years ago
Daniel owns a construction company that builds homes. To help his customers visualize the types of homes he can build for them,
DanielleElmas [232]

Answer:

The correct answer to the following question will be "Computer-assisted design".

Explanation:

  • CAD seems to be computer software or development for creating 2D as well as 3D features or models.
  • This technology could be used in a wide variety of companies and professions which could be used to produce architectural models, construction aims, renderings, power systems, technical diagrams, blueprints as well as visual effects through your favorite films and shows.

So that Daniel uses certain technology to support or create these 3D designs.

3 0
3 years ago
What does the word "e-business" mean?
Zepler [3.9K]
It stands for Electronic Business, a typical example of this is a online store.
4 0
3 years ago
Read 2 more answers
Other questions:
  • What specific information would you need to obtain from an ISP or cloud service provider whose hosting services you wanted to us
    9·1 answer
  • A résumé can be delivered through _____.a.
    9·2 answers
  • Help me please and thanks
    8·1 answer
  • What major criteria must a product or process meet in order to be considered emerging technology?
    6·2 answers
  • To hide the shaded space between pages, ____. select one:
    10·1 answer
  • Historically, storytelling passed down the most important ideas about life, family, and society from generation to generation; t
    10·2 answers
  • Which of the following statements about content-based filtering is TRUE?
    9·1 answer
  • WHO WANT P O I N T S.................................................
    9·1 answer
  • ________ is a group meeting-based process for requirements collection. a. Reverse engineering b. Joint application design c. Hum
    9·1 answer
  • Write a C++ program to grade the answers to a true-false quiz given to students in a course. The quiz consists of 5 true-false q
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!