1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
wlad13 [49]
3 years ago
12

In number theory, a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the

sum of its positive divisors excluding the number itself (also known as its aliquot sum). Equivalently, a perfect number is a number that is half the sum of all of its positive divisors (including itself). Write a Python3 program to check if a user-entered number is a perfect number or not. Use exception handling to handle invalid inputs.
Computers and Technology
1 answer:
rusak2 [61]3 years ago
8 0

Answer:

Explanation:

def the_perfect(n):

  try: #exception handling if n is a negative number

       n > 0

   except: #return -1 if the error is reached

       return -1

  else:

        total = 0

        for i in range(1, n): #for loop from 1 to the target number

           if n % i == 0:

               total += i

   return total == n  #should return true if number is perfect number

print(perfect_number(8))

You might be interested in
which of these tools stick to the edge of an image, thus making it easy to select the shape of an image
USPshnik [31]

Answer:

ljb lih lug outbpiyougvotvoy

outiyfiyfiyfiyffiyvitfurcutfcutcrcutfutcdu

Explanation:

didn't understand the question

3 0
3 years ago
What will you see on the next line? >>> int(6.5)
tankabanditka [31]

Answer:

6

Explanation:

The int functions founds down to the nearest whole number, which in this case would be 6.

8 0
3 years ago
Read 2 more answers
The stub: transmits the message to the server where the server side stub receives the message and invokes procedure on the serve
elena55 [62]

Answer:

It does all of these

Explanation:

The stub is able to do all of what we have in this question. It can locate computer connections, locate ports on a computer, transit message to server etc.

in distributed computing, a stub is a piece of code that does the work of converting parameters that are passed between the client and the server at a time of remote procedure call.

The main objective of an RPC is to allow the client to call procedures remotely on another server.

3 0
3 years ago
Select the correct answer.
goblinko [34]

Answer:

b

Explanation:

8 0
2 years ago
BRAINLIEST ANSWER AWARDED PLEASE HELP
Aleksandr-060686 [28]
When a formula produces output that is too lengthy to fit in the spreadsheet cell, the error that will show is "#####". When you enter an invalid cell reference in a formula, for instance using "AVE(" instead of "AVERAGE("; the error that will show is "#NAME?". When you type text in cells that accept numeric data, for instance adding 1 + 1 + A; then the error that will show is "#VALUE". Lastly, when you type in a cell reference that does not exist, the error that will show is "#REF".
4 0
3 years ago
Other questions:
  • When Aaron was called for an interview at a graphic designing company, his first interview test assessed his creativity and his
    7·2 answers
  • Type the correct answer in the box. Spell the word correctly. What aspect should you consider before adding pictures to a docume
    7·2 answers
  • What is a nonlinear presentation
    9·2 answers
  • Match each invention with its effects on the age of exploration.
    6·2 answers
  • Match each keyboard command with its result.
    6·1 answer
  • By Carl Sandburg
    6·1 answer
  • One tool under What-If-Analysis is Scenarios. Which best describes the purpose of setting up and using scenarios
    5·1 answer
  • Outline the dangers arising as a result of using computers​
    12·1 answer
  • In _____, a program running on a Web server creates a Web page in response to a request for specific information from a Web clie
    7·1 answer
  • Which example illustrates the idea of "collecting data"?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!