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]
2 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]2 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
A looping construct that continues to repeat until the expression becomes false is
Elis [28]

Answer:

a while loop

Explanation:

for an example, while x<4:

the program will end when the value of x greater than 4.

8 0
3 years ago
Read 2 more answers
What is the letter for the trash directory on windows 10?
myrzilka [38]
It's usually in C: drive.
<span>C:\$Recycle.Bin
</span>But if you have several drives, there are Recycle Bins each drive.
3 0
2 years ago
Read 2 more answers
Janeal spends her day looking at the stock and bond markets and evaluating how the portfolios of the businesses she serves will
pychu [463]

Answer:

ur answer good sir will be : financial analyst

and a brainliest will be good to thnx

4 0
3 years ago
What is the MINIMUM number of paths that would need to be broken to prevent Computing Device A from connecting with Computing De
Sveta_85 [38]

Answer:

The answer is "Option c".

Explanation:

In the given question the device A is connected by 3 wires, contributing all of them, which also includes several connector paths. When all the wires of A are broken down, and if all of this leaves no routes that can be used. Even so, if it is done to E, it's also linked to four different routes. Its solution would've been C because its value will be the MINIMUM.

4 0
2 years ago
Read 2 more answers
Sorting Records in a Form
Naya [18.7K]

Answer:

1. Open the form in the standard form view.

2. Put the cursor in the field to use for sorting.

3. Open the Home tab

4. In the Sort & Filter group, click ascending or descending

Explanation:

Took the test :)

7 0
2 years ago
Other questions:
  • The spreadsheet below shows the names years in office, and number of terms for five US presidents
    7·2 answers
  • True or False: You cannot change the default margin size for Word documents.  
    6·1 answer
  • What type of electronic monitoring involves an offender being contacted periodically by telephone or beeper to verify his or her
    5·1 answer
  • Given half a chance other people at work will take advantage of you
    11·1 answer
  • Universal Containers is implementing a community of High-Volume Community users. Community users should be able to see records a
    12·1 answer
  • Which field of study would be most useful for a person who wants to work in a recycling plant?
    12·2 answers
  • Drag the correct type of update to its definition.
    14·1 answer
  • Users who are connecting to an NLB cluster have been complaining that after using the site for a few minutes they are prompted t
    15·1 answer
  • What are storage devices ​
    5·2 answers
  • Naseer has inserted an image into his document but needs the image to appear on its own line.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!