answer.
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]
1 year 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]1 year 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
A Linux systems admin reported a suspicious .py file that ran on a daily schedule after business hours. The file includes shellc
raketka [301]

Answer: Python script

Explanation:

Based on the information given in the question, the type of script that is executing this shellcode is the Python script.

The Python script is a file that contains codes that are written in Python. In such case, the file which contains the python script typically has an extension

which is ".py"' or ".pyw" when it's run on windows

Therefore, based on the information given, the answer is Python script.

8 0
2 years ago
A colleague sent you an awesome article about using proper ergonomics while sitting at the computer. You don't have time to read
lys-0071 [83]

Answer: Select the article attachment and save it to your computer.

Explanation:

5 0
2 years ago
Write a method called justFirstAndLast that takes a single String name and returns a new String that is only the first and last
NemiM [27]

Answer:

Answer is in the attached screenshot.

Explanation:

Using regex to split a given input string via whitespace, then returns the first and last element of the array.

6 0
2 years ago
When you check to see how much RAM, or temporary storage you have available, you are checking your _____.
victus00 [196]

Answer: primary memory

5 0
2 years ago
You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
vagabundo [1.1K]

Answer:

The answer is "check the worksheet is not read only"

Explanation:

The read only mode is used for read the file data, and it doesn't allows the user to update the file, and for updating the worksheet we should check iut does not open in the read-only mode.

If it is open, then we close it and for close we goto the office button and click on the tools option after that goto general setting, in this there is a check box for turn off the read-only mode.

 

8 0
2 years ago
Other questions:
  • In three to five sentences, describe whether or not files should be deleted from your computer.
    13·2 answers
  • Letitia is in high school. She wants to go to medical school in Kentucky and then become a pediatric surgeon to help children. W
    5·2 answers
  • An administrator has initiated the process of deploying changes from a sandbox to the production environment using the Force IDE
    5·1 answer
  • Use the image below to answer this question.
    14·1 answer
  • A _________________________ can use SOAP headers to carry meta information in its messages. A. Web service B. REST Service C. Co
    14·1 answer
  • XYZ Corp.’s facilities in Nashua, New Hampshire, are two office buildings 400 feet apart, each with its own LAN. To connect the
    9·1 answer
  • Write the notInVocab method. Assume that there are no duplicates in wordArray. You must call findWord and countNotInVocab approp
    10·1 answer
  • You discover many errors in a database table. What has been lost?
    15·2 answers
  • Hashing algorithms are used on evidence files to uphold the chain of custody in an investigation. Which of the following is NOT
    5·1 answer
  • **Click the photo** Put the steps in order to produce the output shown below. Assume the indenting will be correct in the progra
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!