Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started