Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics Systems Engineering Cybersecurity Project Management

Authors: Christopher Greco

1st Edition

168392648X, 978-1683926481

More Books

Students also viewed these Databases questions

Question

1. How do most insects respire ?

Answered: 1 week ago

Question

Who is known as the father of the indian constitution?

Answered: 1 week ago

Question

1.explain evaporation ?

Answered: 1 week ago

Question

Who was the first woman prime minister of india?

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago