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
hackers can use as part of a reconnaissance process to learn about active network addresses and active processes?
aalyn [17]

Answer:

ICMP.

Explanation:

Hackers might use ICMP for gain knowledge about current system addresses and specific procedures as part of a reconnaissance process.

ICMP is a failure informing system used by network protocols such as routers to produce warning to that of the source Address while network issues interrupt IP packet transmission.

3 0
3 years ago
#Create a class called Name. Name should have two attributes
prisoha [69]

Answer:

//class Name

class Name {

// attributes gave you 3

String first_name;

String last_name;

int length = 0;

//constructor with 2 parameters

Name(String first_name, String last_name){

}

//methods

public String find_printed_name(){

return first_name + " " + last_name;

}

public void find_sortable_name(){

return last_name + ", " first_name.charAt(0);

}

public static void main(String[] args){

// instantiate the class

Name test_name = new Name("David", "Joyner");

System.out.println(test_name.first_name);

System.out.println(test_name.last_name);

System.out.println(test_name.find_printed_name());

System.out.println(test_name.find_sortable_name());

}

Explanation:

You didn't specify a language so I did it in Java.

You should know how to declare methods in Python.

3 0
3 years ago
Smith wants to get a job in network systems. Which major should he choose to give him the best chance of getting a job?
Sever21 [200]
<span>computer engineering</span>
5 0
4 years ago
Read 2 more answers
Using C++, complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2
victus00 [196]

Answer:

#include <iostream>

using namespace std;

void PrintPopcornTime(int bagOunces) {

   if(bagOunces < 2)

       cout << "Too small" << endl;

   else if(bagOunces > 10)

       cout << "Too large" << endl;

   else

       cout << 6 * bagOunces <<" seconds" << endl;

}

int main()

{

   int userOunces;

   cin >> userOunces;

   PrintPopcornTime(userOunces);

   return 0;

}

Explanation:

Inside the function PrintPopcornTime, check the parameter bagOunces using if structure. Depending on the value of bagOunces, print the required information.

Inside the main, ask the user for the userOunces. Call the PrintPopcornTime function with the userOunces.

3 0
3 years ago
Assuming P != NP, which of the following is true ?
White raven [17]

Answer:

Answer is B, see explanations.

Explanation:

Answer is (B) NP−complete∩P=ϕ

Since, P≠NP, there is at least one problem in NP, which is harder than all P problems. Lets take the hardest such problem, say X. Since, P≠NP,X∉P .

Now, by definition, NP−complete problems are the hardest problems in NP and so X problem is in NP−complete. And being in NP, X can be reduced to all problems in NP−complete, making any other NP−complete problem as hard as X. So, since X∉P, none of the other NP−complete problems also cannot be in P.

7 0
3 years ago
Read 2 more answers
Other questions:
  • What is an independent data mart?
    8·1 answer
  • Which of the following was one of the first internet search engines? A. archie B. google C. Yahoo D.ask
    7·1 answer
  • Voice and fingerprint _______ can significantly improve the security of physical devices and provide stronger authentication for
    14·1 answer
  • 3. What are the first steps that you should take if you are unable to get onto the Internet? (1 point)
    15·1 answer
  • How can i promote netiquette??​
    10·1 answer
  • (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. The last
    9·1 answer
  • If one breakfast meal of banana lacatan, scrambled egg, plain rice, and hot milk contains 58 grams carbohydrate, 12 grams protei
    11·1 answer
  • What is information technology?
    9·1 answer
  • terms found in provider documentation (e.g., difficult, extensive, or unusual) would support adding modifier to a cpt code.
    8·1 answer
  • should variables that contain numbers always be declared as integer or floating-point data types? why or why not? name potential
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!