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!")
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!")
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 21PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning