Perfect numbers
Task
A number is perfect if it equals the sum of its divisors other than itself. For example, 28 has the divisors 1, 2, 4, 7 and 14, and 1 + 2 + 4 + 7 + 14 = 28. Other perfect numbers are 6, 496, 8128 and 33550336.
Write a subprogram (function) je_dokonale(cislo) that returns True or False for a positive whole number.
The main program under if __name__ == "__main__": reads how many numbers the user wants to check, then the numbers (each on its own line), and prints the function's answer for each.
Examples
Input
3 6 28 12
Expected output
True True False
Rules
Write the function
je_dokonale(cislo).The function must return its result with
return.
After you submit, 4 hidden tests will also check your solution: 496, 8128, 1 and 2, a single number, numbers that are not perfect, the function returns True/False.
Python starts the first time you run code.
Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.
Input (stdin)
Each line = one call to input().
Output
Hints
Try it yourself first. Each hint reveals a little more - and lowers the reward a little.
Signed out, hints are free - but no XP is awarded either.
Solution
The solution unlocks after the last hint.