Answer to Question #303583 in Python for Cristelle Maddela

Question #303583

Create a Python script which will accept a positive integer and will determine the input number if PERFECT, ABUNDANT, DEFICIENT.


I need the code to have an output.


1
Expert's answer
2022-02-28T01:07:47-0500
def perfect_number(n):
    sum = 0
    for x in range(1, n):
        if n % x == 0:
            sum += x
    return sum == n
print(perfect_number(6))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS