Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Lab 7 – Python

Lab 7

 

Answer;

Q1

*
* *
* * *
* * * *
*
* * *
* * * * *
* * *
*

 

Q2


primes = []
N = int(input("Please enter a number greater than 1: "))
D=N
F = 2
while N > 1:
    #Check if F divides N
    if N // F == N / F:
        primes.append(str(F))
        N = N // F
    else:
    #increase F by 1
        F += 1
answer = ",".join(primes)
print("The prime factors of ",D," are ", answer)

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!