```
def type_of_num(num):
factors = []
for i in range(1, num + 1):
if num % i == 0:
if i != num:
factors.append(i)
if sum(factors) == num:
type_num = "Perfect"
elif sum(factors) > num:
type_num = "Abundant"
else:
type_num = "Deficient"
return type_num, factors
print(type_of_num(32))
```

# Find perfect abundant or deficient factors in python

Carvia Tech | May 04, 2019 at 11:40 AM | 4 views | Python Coding Problem

Positive integers can be classified as abundant, deficient, or perfect. Abundant integers are those whose proper factors sum to a larger number.

For example, 36 is an abundant number because its proper factors (1, 2, 3, 4, 6, 9, 12, 18) sum to 55 which is greater than 36. Deficient integers are those whose proper factors sum to a smaller number. For example, 27 is a deficient integer because its proper factors (1, 3, 9) sum to 13 which is less than 27.

Perfect integers are those whose proper factors sum to exactly that number. For example, 28 is a perfect integer because its proper factors (1, 2, 4, 7, 14) sum to exactly 28. Given a positive integer value, determine if it is abundant, deficient, or perfect. Also list its perfect factors and the sum of those perfect factors.

('Deficient', [1, 2, 4, 8, 16])

###### Top articles in this category:

- Top 100 interview questions on Data Science & Machine Learning
- python problem 1: find the runner-up score
- Introduction to Python 3.6 & Jupyter Notebook
- Creating custom Keras callbacks in python
- Write a program to check if the given word is Isogram & Pair isogram in python
- Pass the ball game: NxN matrix in python
- Creating AWS Lambda using python 3.6

###### Find more on this topic:

##### Machine Learning

Data science, machine learning, python, R, big data, spark, the Jupyter notebook, and much more

Last updated 1 month ago

###### Recommended books for interview preparation:

##### Facebook Page

##### Similar Posts

- Count the number of open lockers in school
- Introduction to Sorting Algorithms
- Difference between Loss, Accuracy, Validation loss, Validation accuracy when training deep learning model with Keras
- Guide to read data from google drive in Google Colaboratory
- Creating AWS Lambda using python 3.6
- Write a python program to find Largest Substring that occurs more than once
- Write a program for Hailstone Sequence in Python
- Find perfect abundant or deficient factors in python
- Write a program to find if a number is Lychrel Number in Python
- Write a program to check if the given word is Isogram & Pair isogram in python

Enter your email address to subscribe to this blog and receive notifications of new posts by email.