Question: I need fix the print in my python please help my code is https://codeshare.io/5ZD7Xo my print Prime factors of 10 are 2 5 how can

I need fix the print in my python please help

my code is https://codeshare.io/5ZD7Xo

my print Prime factors of 10 are 2 5 how can I fix Prime factors of 10 are 2, 5

and I want one more error Invalid input for not this primes=="Y"or primes=="N"

my code

def sqrt(num): ret = num**(1/2.0) return int(ret)

def printprime(num): ret = False for i in range(2, num + 1): prime = True if num % i == 0: for j in range(2, sqrt(i)+1): if i % j == 0: prime = False break if prime: print(i, end=" ") ret = True if not ret: print("No Prime Divisors")

def main_function(): 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: print("Prime factors of",pnum,"are",end=" ") ret = printprime(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.")

main_function()

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!