subject
Computers and Technology, 18.02.2020 00:03 jaz279

Fill in the blanks to make the print_prime_factors function print all the prime factors of a number prime factor is a number that is prime and divides another without a remainder.
def print_prime_factors(number):
# Start with two, which is the first prime
factor = 2
# Keep going until the factor is larger than the number
while factor <= number:
# Check if factor is a divisor of number
if number % factor == ___:
# If it is, print it and divide the original number
print(factor)
number = number / factor
else:
# If it's not, increment the factor by one ___
return "Done"
print_prime_factors(100) # Should print 2,2,5,5

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:10
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it must not appear in the factorization. sample runs are given below. note that if the power of a prime is 1, then that 1 must appear in t
Answers: 3
question
Computers and Technology, 22.06.2019 12:40
The most complicated four letter word
Answers: 1
question
Computers and Technology, 23.06.2019 06:40
What are the three uses of a screw?
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a.if the manual switch s is on, then the light l is on. b.besides the manual switch, there is a motion detector, m1, which activatesthis light.c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d.the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
You know the right answer?
Fill in the blanks to make the print_prime_factors function print all the prime factors of a number...
Questions
question
Mathematics, 24.01.2022 23:40
question
Mathematics, 24.01.2022 23:40
question
Physics, 24.01.2022 23:40
Questions on the website: 13722360