Question: Problem 5 In a new file named lab 6 _ p 5 . py , write a program that takes a positive integer as input

Problem 5
In a new file named lab6_p5.py, write a program that takes a positive integer as input and checks if it's a perfect number. A perfect number is a positive integer that is equal to the sum of its positive divisors excluding itself. For example, 6 is a perfect number because its positive
divisors are 1,2, and 3, and 1+2+3=6.28 is also a perfect number because 1+2+4+7+14=28.
The input must be positive. If not, the program will output "Invalid input." and ask for an input again.
Below are two sample executions of the program. The bold text represents user input. Your program should matchthe output in exactly the same format. Use while loops to solve this problem.
Enter a positive integer: 6
6 is a perfect number!
Enter a positive integer: -7
Invalid input.
Enter a positive integer: 7
7 is not a perfect number.
 Problem 5 In a new file named lab6_p5.py, write a program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!