UrbanPro

Learn Python Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How can I print perfect numbers in a given range in Python?

Asked by Last Modified  

Follow 5
Answer

Please enter your answer

mca mphil

def print_perfect_nums(start, end): for i in range(start, end + 1): sum1 = 0 for x in range(1, i): # Check if a divisor, if it is, add to sum if(i % x == 0): sum1 = sum1 + x if (sum1 == i): print(i) print_perfect_nums(1, 300)Perfect number is sum of...
read more
def print_perfect_nums(start, end):   for i in range(start, end + 1):   sum1 = 0   for x in range(1, i):      # Check if a divisor, if it is, add to sum      if(i % x == 0):         sum1 = sum1 + x         if (sum1 == i):            print(i)print_perfect_nums(1, 300)

Perfect number is sum of the divisorsa of the number is equal to the same number eg 6 divisors
are 1,2,3
read less
Comments

Related Questions

My basic qualification is Diploma in Electrical and Electronics Engineering completed in the year 2010. I want to know whether Python is easy to learn since my knowledge is 0 in programming track?
Hi Elavarasan, Python is very easy language to learn, and you are from Electronics background then I will suggest you to go for Internet of Things. which is very popular in the market with high pay scale....
Elavarasan
how can i develop a python project without disturbing python core
We will help you with you requirement.Contact us.Training will enable you to complete the task.
Garimella
Hi, can anyone tell me where I can learn more and be professionally guided on 1-1 basis , on Machine Learning and Deep learning using Python? I already have statistics and programming background
I would first recommend taking some good Linear Algebra course, you would need some intuitive understanding about concepts like linear leas squares, singular value decomposition, normal equations,etc....
Ravi
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Visualize your python code
Hi All, Many developers in the beginning of their career want to visualize how their code is working and the program flow. You can use the following link to visualize your python code. http://www.pythontutor.com/visualize.html#mode=edit ...

DBMS - SQL - Any/All
All - Operator SELECT empno, sal FROM emp WHERE sal > ALL (1999, 2999, 3999); Output of Above query is same as below query SELECT empno, sal FROM emp WHERE sal > 1999 AND sal > 2999...

Radhe Shyam

0 0
0

Python Important Operation Formats and Sytnax.
Hello Python Enthusiast, Though Python is considered as one of the easisest language to learn in the market, many freshers and beginners will find great difficulty in understansing the syntax and also...

Write your first Python program in 10 minutes
1. Download python from python official site search "python download" in google 2. Install in your machine 3. verify using : "python --version" command 4. Write first program using notepad create...

Why Python
Python can be used in any futuristics technology A= Analytics Data Science Artificial Intelligence(AI) Neural Network(NN) Natural Language Processing(NLP) Computer Vision(OpenCV) In Analytics...

Recommended Articles

Python is one of the most popular programming languages in the world. It is general-purpose, object oriented, high-level programming language used in a number of programming fields. Python is a great programming language to learn as it will introduce you to the world of programming. If you are from the technical background...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Looking for Python Training classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Python Training Classes?

The best tutors for Python Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Python Training with the Best Tutors

The best Tutors for Python Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more