Question: Write a Python program to input a series of number from user and find Prime factors of each given number using a loop. Program will

Write a Python program to input a series of number from user and find Prime factors of each given number using a loop. Program will ask the user to continue or not each time and if user answers yes ask for the number otherwise stop the program. Hint: You need to use a nested loop.

Must include at least 3 functions.

Example

Do you want to find primes? (Y/N): y

Input any positive number: 10 Prime factors of 10 are 2, 5

Do you want to find primes? (Y/N): y

Input any positive number: A10

Invalid input must be a number.

Do you want to find primes? (Y/N): y

Input any positive number: -10

Inputted value must be a positive number

Do you want to find primes? (Y/N): y

Input any positive number: 125678

Prime factors of 125678 are 2, 7, 47, 191

Do you want to find primes? (Y/N): N

Have a nice day.

my code:

print("Do you want to find primes? (Y/N):", end="") primes = input().upper() while (primes=="Y"): print("Input any positive number:",end="") try: pnum=int(input()) if pnum>=0: pnum=pnum else: print("Inputted value must be a positive number") except: print("Invalid input must be a number.") print("Do you want to find primes? (Y/N):", end="") primes = input().upper()

print("Have a nice day.")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!