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
dlinn [17]
2 years ago
13

Factoring of integers. Write a python program that asks the user for an integer and then prints out all its factors. For example

, when the user enters 150, the program should print 2 3 5 5.
This is just a pseudocode for visual:
Get a value from user Print
"The factors are: "
Keep going while the value is greater than 1
Start the divisor at 2 A factor has not been found Keep going until a factor is found
If the value is evenly divisible by the divisor
A factor has been found
Print the divisor Change value to equal value / divisor.
You have now found a factor you want to see if there are factors in the remaining part of the number.
FYI: For instance if the number is 100, your first factor would be 2 and on our second time through you would need to see if there are factors of 50. This would result in another factor of 2 in the third pass and looking for factors of 25. This would result in a factor of 5 in the fourth pass and looking for factors of 5. This would result in value finally = 1 so you are done. If I enter 175, I would see 5, 5, and 7 as my results. Increment the divisor so you can see if the next number is a factor. This statement is not necessary if a factor is found, but it does not matter if it is executed because you will fall out of the inside nested if and reset the divisor to 2 if you come back in.
Computers and Technology
1 answer:
Oduvanchick [21]2 years ago
8 0

num = int(input("Enter a number: "))

i = 2

while num > 1:

   if num % i == 0:

       num = num / i

       print(i, end=" ")

       i = 2

   i += 1

I hope this helps!

You might be interested in
Which of the following is not a true statement? You can import a table or a query directly from an Access database into an Excel
Lilit [14]

Answer:

does anybody know this answer?

Explanation:

no nobody does

5 0
3 years ago
Suppose the sender wants to send the following bit stream by using bit stuffing. What would the sender transmit if the following
Helen [10]

The purpose of bit stuffing is used as a delimiter to mark the end of one frame and the beginning of the next frame.

<h3>What is Bit Stuffing?</h3>

This refers to the use of one or more information bits in order to break up the message for easy synchronization.

The parts of a frame are:

  1. Frame header
  2. Payload field
  3. Trailer
  4. Flags.

<h3>What is a Flag?</h3>

This is a bit pattern that is used to define the start and end bits in a given frame and the 8-bit pattern 01111110 as the flag is commonly used.

Hence, we can see that your question is incomplete so I gave you a general overview to help you have a better understanding of the concept.


Read more about bit stuffing here:

brainly.com/question/12949292
#SPJ1

7 0
2 years ago
PL Technologies suffered considerable data loss when its database was infected by a virus. George, an operations personnel, atte
Luba_88 [7]

Answer:

Recovery is the correct answer to the given question.

Explanation:

Recovery is used when the data is lost from the database in any issue Database Recovery is giving the data to returning in its consistent state of the database.

When George sees that the  PL Technologies is suffered from considerable data loss due to it is infected by a virus then George retrieving the information and the data by using the recovery process  

6 0
3 years ago
Assume you have a variable, budget, that is associated with a positive integer. Assume you have another variable, shopping_list,
max2010maxim [7]

Answer:

budget=455

shopping_list=("codelab", "textbook", "ipod", "cd", "bike")

prices={"codelab":300, "textbook":100,"ipod":50, "cd":10, "bike":600}

number_of_items=0

sum=0

for index in range(len(shopping_list)):

   sum=sum+prices[shopping_list[index]]

   if (sum<=budget):

       number_of_items=number_of_items+1

   else :

       break

print "number of items you can purchase, for a budget of",budget,"is",number_of_items

Explanation:

A code to determine the number of items that can be purchased is above, given the value associated with budget, and given that you will buy items in the order that they appear in the tuple associated with shopping_list.

4 0
2 years ago
When dealing with perspective, _____ lines are used or implied.
iris [78.8K]

Answer:

I'm pretty sure the answer is vanishing lines.

Explanation:

7 0
2 years ago
Other questions:
  • What is one way to process your thoughts about the information you are reading?
    14·2 answers
  • Cuales son los accesorios electronicos mas recomendados?
    6·1 answer
  • You have a site (Site1) that has about 20 users. For the last few months, users at Site1 have been complaining about the perform
    9·1 answer
  • PLEASE HELP!
    12·2 answers
  • Indicate the time efficiency classes of the three main operations (i.e., FindMax, DeleteMax, and Insert) of the priority queue i
    11·1 answer
  • Why is it a best practice of a remote access policy definition to require employees and users to fill in a separate VPN remote a
    14·1 answer
  • An effective team would never have ______.
    13·1 answer
  • A college student needs a laptop that can be used while committing on the train and sitting in a lecture
    13·1 answer
  • 4.2 lesson practice last one plzs help
    5·2 answers
  • PLEASE HELP, Answer Correctly..Will give a bunch of brainlist points ​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!