In (3) def isPerfect (x) ***Returns whether or not the given number x is perfect. A number is said to be perfect if it is equal to the sum of all its factors (for obvious reasons the list of factors being considered does not include the number itself). Example: 63+2+1, hence 6 is perfect. Example: 20 is another example since 1+2 +4 + 7 + 14 in 28. Note, the number 1 is not a perfect number. *** your code here Sum - 0 for i in range(1, x) LE(0)1 Sun Bum + 1 if (Bum=-X) else! print(" td is a Perfect Number 1x) print(td is not a Perfect Number" 1x) print (isPerfect (6)) File "cipython-input-3-b9df3e539048", line 15 for i in range(1, x) IndentationError: unexpected indent In 1411 perfect numbers 16, 28, 496, 8126, 335503361 for i in perfect numbers: assert true (isPerfect (i), str(i)+ is perfect') not perfect numbers (2, 3, 4, 5, 7, 8, 9, 10, 495, 8127, 8129, 335503351 for i in not perfect numbers assert true (not (isPerfect (i)), str(i) is not perfect') test existence of doestring assert true(len (isPerfect._doc_) 1, "there is no docstring for isPerfect") print("Success!")

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
In [3]: def isPerfect (x):
***Returns whether or not the given number x is perfect.
A number is said to be perfect if it is equal to the sum of all its
factors (for obvious reasons the list of factors being considered does
not include the number itself).
Example: 6 = 3 + 2 + 1, hence 6 is perfect.
Example: 28 is another example since 1 + 2 + 4 + 7 + 14 is 28.
Note, the number 1 is not a perfect number.
your code here
Sum - 0
for i in range(1, x)
if(x1= 0):
Sun - Sum + 1
if (Sum X)I
print(" td is a Perfect Number" 1x)
print(" td is not a Perfect Number 1x)
else:
print (isPerfect (6))
File "cipython-input-3-b9df3e539e48", line 15
for i in range(1, x):
IndentationError: unexpected indent
In [411 perfect numbers [6, 28, 496, 8128, 335503361
for i in perfect_numbers:
assert true (isPerfect (i), str(i) + is perfect')
not_perfect_numbers [2, 3, 4, 5, 7, 8, 9, 10,
495, 8127, 8129,
335503351
for i in not perfect_numbers:
assert true (not (isPerfect (i)), str(i) is not perfect')
#test existence of doestring
assert true (len (isPerfect._doc_) > 1, "there is no docstring for isPerfect")
print("Success!")
Transcribed Image Text:In [3]: def isPerfect (x): ***Returns whether or not the given number x is perfect. A number is said to be perfect if it is equal to the sum of all its factors (for obvious reasons the list of factors being considered does not include the number itself). Example: 6 = 3 + 2 + 1, hence 6 is perfect. Example: 28 is another example since 1 + 2 + 4 + 7 + 14 is 28. Note, the number 1 is not a perfect number. your code here Sum - 0 for i in range(1, x) if(x1= 0): Sun - Sum + 1 if (Sum X)I print(" td is a Perfect Number" 1x) print(" td is not a Perfect Number 1x) else: print (isPerfect (6)) File "cipython-input-3-b9df3e539e48", line 15 for i in range(1, x): IndentationError: unexpected indent In [411 perfect numbers [6, 28, 496, 8128, 335503361 for i in perfect_numbers: assert true (isPerfect (i), str(i) + is perfect') not_perfect_numbers [2, 3, 4, 5, 7, 8, 9, 10, 495, 8127, 8129, 335503351 for i in not perfect_numbers: assert true (not (isPerfect (i)), str(i) is not perfect') #test existence of doestring assert true (len (isPerfect._doc_) > 1, "there is no docstring for isPerfect") print("Success!")
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education