Question: Can someone edit this to take the perfect numbers generated between 1,100000 and store them in a list. I want both the number of perfect

Can someone edit this to take the perfect numbers generated between 1,100000 and store them in a list. I want both the number of perfect numbers and the perfect numbers themselves printed in the final answer. #Defines the perfect function def isPerfect(num): #Sets counter PerfectNumber=0 #Numbers in range for i in range (1,num): #Perfect number has to be divisible by itself or another number evenly if (num%i==0): #If thats true, add it to the counter PerfectNumber+=i return PerfectNumber==num #Defines the function for the range of values def main(): #Sets counter count=0 #Asked to find range between 1-100000 for i in range(1,100000): if (isPerfect(i)): count+=1 print () print("The number of perfect numbers found between 1 and 100000 is:",count) main()

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!