Загрузка...

3.9 – Perfect Number Program | Python Programming – New Series

Welcome to the Python Programming – Complete Course (New Series) by Burle Sharma.

In this class (3.9), we learn how to write a program to:

👉 Accept a number from the user
👉 Check whether the number is a Perfect number or not

In this video, I have:

✔ Written the expected output clearly
✔ Explained the problem statement properly
✔ Performed a detailed dry run step by step
✔ Executed the program and verified the output

This program strengthens your understanding of factor logic and conditional statements.

🎓 What You’ll Learn in This Video

• Accepting user input in Python
• Understanding what a Perfect number is
• Using loop to find proper factors
• Using accumulator (sum variable)
• Applying conditional statements
• Dry run for better logical clarity
• Execution and output verification

🧠 Key Learning Point

A Perfect number is a number whose sum of proper factors (excluding the number itself) is equal to the number.

Example:
6 → Factors: 1, 2, 3
Sum = 1 + 2 + 3 = 6
So, 6 is a Perfect number.

✔ Loop runs from 1 to n-1
✔ Check divisibility using % operator
✔ Add factor to sum if divisible
✔ Compare sum with original number
✔ If equal → Perfect number
✔ Else → Not a Perfect number

This concept builds a strong base for:

• Factor-based programs
• Prime and Composite logic revision
• Number-based problem solving
• Competitive coding fundamentals

#Python #PythonProgrammingNewSeries #BurleSharma
#PerfectNumber #NumberPrograms
#WhileLoopPython #PythonBeginners
#PythonModulusOperator #PythonDryRun
#LoopPrograms #Geecoding #PythonClass9

Видео 3.9 – Perfect Number Program | Python Programming – New Series канала Burle Sharma (geecoding)
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять