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 wireless security methods uses a common shared key configured on the wireless access point and all wireless clients?
Korolek [52]

Answer:

WEP, WPA Personal, and WPA2 personal, these are the wireless security method which are used common shared key configured on the wireless access point and wireless clients. WEP is the wired equivalent privacy and WPA stands for wifi protected access.

These are the wireless security protocols, which basically provide the wireless security to the system. Wireless network are transmitted within the range for every direction. WPA modern application used the pre shared key system and this system are developed for link the device to the access point easily.

4 0
3 years ago
Isabela wants to edit a presentation for her science class. She is in the main view of the PowerPoint application
Karolina [17]

Answer:Click the File tab, and click the Open option.

Explanation: correct on edge

8 0
4 years ago
When are computers most vulnerable to threats or damage?
valentinak56 [21]
With virus protection
8 0
4 years ago
Which of the following is the largest measurement for the weight of a bag of dog food?
jasenka [17]

Answer:

approximately 5 lbs but no sure weight.

6 0
3 years ago
Read 2 more answers
1. To collect data from two websites with different URLs using a single Google Analytics property, what feature must be set up?
Finger [1]

Answer:Cross domain tracking

Explanation: Cross domain tracking is the tracking activity of the several domains in the Google Analytics property's single unit. This tool works for tracking by the means of debugging and finding solution of the problem.

Cross tracking is also seen as the complex task and the solution is not east to obtain.This tools comes into action when domain session need the tracking of two or more domains or sub-domains.

6 0
3 years ago
Other questions:
  • Nicole wants to create a database to collect information about videos in her video rental store. She would like to use the datab
    9·1 answer
  • A model release can be either oral or written down. true or false
    13·2 answers
  • What type of cable is used to connect a workstation serial port to a cisco router console port?
    15·1 answer
  • Which extension is appropriate for Word document templates?
    10·2 answers
  • Can anybody tell me how to screenshot on a PC with no "print screen" button?
    11·1 answer
  • I WILL GIVE BRAINLIEST
    9·1 answer
  • Any one know??please let me know
    15·2 answers
  • What will you see on the next line? >>> int(6.5)
    12·2 answers
  • A brick has a weight of 23N. The brick is flat and smooth on the side in contact with the floor having measurements ( height= 5c
    13·1 answer
  • which filename refers to a 16-bit real-mode program that queries the system for device and configuration data, and then passes i
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!