Abundant Number Check
Check if sum of proper divisors exceeds the number.
IntermediatePhase 2 - Level 2: Number-based Looping LogicExample 14 of 14
abundant-number-check.py
1# Take number2num = int(input("Enter a number: "))34# Find sum of proper divisors5divisor_sum = 06for i in range(1, num):7 if num % i == 0:8 divisor_sum += i910# Check abundant11if divisor_sum > num:12 print("Abundant number")13else:14 print("Not an abundant number")
Output
Enter a number: 12 Abundant number
What's going on
Sum of proper divisors > number.
Key Concepts:
Find all proper divisors
Sum them
Compare with number
🔗Related Content
- 📖
Phase 2 - Learn Concepts
Review Phase 2 concepts and explanations
- 📝
Phase 2 - Quiz
Test your Phase 2 understanding with quiz questions
- 💻
Phase 2 - All Practice Problems
Explore all practice problems for Phase 2
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum