Given a list of the integer numbers and we have to print all perfect numbers present in the given list.
This Program iterating through each number one by one in the list, and check whether a given number is a perfect number or not. If a perfect number is found then print it else skip it.
In this program, checkPerfectNum() function is used to find its all positive divisors excluding that number and sum it all and then check for perfect number condition.
Explanation: For Example, 28 is a perfect number since divisors of 28 are 1, 2, 4,7,14 then sum of its divisor is 1 + 2 + 4 + 7 + 14 = 28.
Python code to print perfect numbers from the given list of integers
Output
need an explanation for this answer? contact us directly to get an explanation for this answer