Coding Explained #4

Basics of Python Programming Introduction to Python Programming for Beginners
3 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€47.65
List Price:  €66.72
You save:  €19.06
£39.75
List Price:  £55.66
You save:  £15.90
CA$69.76
List Price:  CA$97.68
You save:  CA$27.91
A$76.72
List Price:  A$107.42
You save:  A$30.69
S$67.33
List Price:  S$94.27
You save:  S$26.93
HK$388.98
List Price:  HK$544.61
You save:  HK$155.62
CHF 44.44
List Price:  CHF 62.21
You save:  CHF 17.77
NOK kr552.21
List Price:  NOK kr773.14
You save:  NOK kr220.92
DKK kr355.46
List Price:  DKK kr497.67
You save:  DKK kr142.21
NZ$85.44
List Price:  NZ$119.62
You save:  NZ$34.18
د.إ183.61
List Price:  د.إ257.07
You save:  د.إ73.46
৳5,939.10
List Price:  ৳8,315.22
You save:  ৳2,376.11
₹4,213.04
List Price:  ₹5,898.59
You save:  ₹1,685.55
RM222.55
List Price:  RM311.59
You save:  RM89.04
₦84,406.11
List Price:  ₦118,175.31
You save:  ₦33,769.20
₨13,801.73
List Price:  ₨19,323.52
You save:  ₨5,521.79
฿1,732.09
List Price:  ฿2,425.07
You save:  ฿692.97
₺1,728.86
List Price:  ₺2,420.55
You save:  ₺691.68
B$292.03
List Price:  B$408.86
You save:  B$116.83
R902.23
List Price:  R1,263.20
You save:  R360.96
Лв93.33
List Price:  Лв130.67
You save:  Лв37.34
₩70,055.22
List Price:  ₩98,082.92
You save:  ₩28,027.69
₪183.99
List Price:  ₪257.61
You save:  ₪73.61
₱2,950.89
List Price:  ₱4,131.49
You save:  ₱1,180.59
¥7,719.70
List Price:  ¥10,808.21
You save:  ¥3,088.50
MX$1,019.17
List Price:  MX$1,426.92
You save:  MX$407.75
QR182.09
List Price:  QR254.95
You save:  QR72.85
P678.99
List Price:  P950.64
You save:  P271.65
KSh6,481.20
List Price:  KSh9,074.20
You save:  KSh2,593
E£2,480.36
List Price:  E£3,472.70
You save:  E£992.34
ብር6,084.35
List Price:  ብር8,518.58
You save:  ብር2,434.22
Kz45,607.24
List Price:  Kz63,853.79
You save:  Kz18,246.54
CLP$49,495.04
List Price:  CLP$69,297.02
You save:  CLP$19,801.98
CN¥362.27
List Price:  CN¥507.21
You save:  CN¥144.94
RD$2,995.34
List Price:  RD$4,193.72
You save:  RD$1,198.37
DA6,698.21
List Price:  DA9,378.03
You save:  DA2,679.82
FJ$113.66
List Price:  FJ$159.14
You save:  FJ$45.47
Q385.78
List Price:  Q540.13
You save:  Q154.34
GY$10,455.70
List Price:  GY$14,638.82
You save:  GY$4,183.11
ISK kr6,934.11
List Price:  ISK kr9,708.31
You save:  ISK kr2,774.20
DH502.94
List Price:  DH704.15
You save:  DH201.21
L913.81
List Price:  L1,279.41
You save:  L365.59
ден2,935.13
List Price:  ден4,109.41
You save:  ден1,174.28
MOP$398.48
List Price:  MOP$557.91
You save:  MOP$159.42
N$896.87
List Price:  N$1,255.69
You save:  N$358.81
C$1,828.79
List Price:  C$2,560.45
You save:  C$731.66
रु6,712.09
List Price:  रु9,397.46
You save:  रु2,685.37
S/188.45
List Price:  S/263.85
You save:  S/75.39
K200.10
List Price:  K280.16
You save:  K80.05
SAR187.68
List Price:  SAR262.77
You save:  SAR75.08
ZK1,372.96
List Price:  ZK1,922.26
You save:  ZK549.29
L237.18
List Price:  L332.07
You save:  L94.89
Kč1,207.21
List Price:  Kč1,690.20
You save:  Kč482.98
Ft19,630.30
List Price:  Ft27,483.99
You save:  Ft7,853.69
SEK kr549.29
List Price:  SEK kr769.05
You save:  SEK kr219.76
ARS$50,200.78
List Price:  ARS$70,285.11
You save:  ARS$20,084.33
Bs345.34
List Price:  Bs483.50
You save:  Bs138.16
COP$217,970.90
List Price:  COP$305,176.71
You save:  COP$87,205.80
₡25,315.87
List Price:  ₡35,444.24
You save:  ₡10,128.37
L1,255.96
List Price:  L1,758.45
You save:  L502.48
₲388,002.60
List Price:  ₲543,234.69
You save:  ₲155,232.08
$U2,130.69
List Price:  $U2,983.14
You save:  $U852.45
zł206.52
List Price:  zł289.14
You save:  zł82.62
Already have an account? Log In

Transcript

Hey guys, welcome again to the tutorial on python programming. Today we shall be discussing about printing strong numbers. Now in in terms of maths we call it the numbers which actually whose sum of factorial of digits is equal to the original number that is known as strong number, okay. So what we are going to do is for example 145 factorial of one four plus factorial of four plus factorial of five gives it 145. Hence, 145 is a strong number, okay, so what we are going to do is as per the logic we are going to extract the numbers and find the factorial of each extracted number as a digit right from the right hand side and keep on storing the sum of that particular digit into the factorial of the digit into a variable right. And then finally be able to check if that variable is equal to the original number Right, so let's start.

Once again I tell you strong numbers are the numbers who some of factorial of digits is equal to the original number, right? So I define a variable someone as zero initializing it at zero. Then of course, the other number is we input the number which has to be checked, whether it's a strong number or not. So we have initialized the very inputted or the insert number into temp variable, then we have taken a while loop while the number is positive or greater than zero. So I initialize a variable i by one f by one and then extract the digit from the number in R, and then we check by i is less than or equal to art in order to find the factorial of that digit, extracted digit. So f is the variable which is storing the factorial and then of course is equal to i plus one.

And then we proceed on to the next. But before that we tried to store the computed factorial of the digit, the extracted digit in the variable sum one, and then we define the new number as number divided by 10. So that we extract one digit from the right. And then once the loop is over, we check whether the sum one is equal to temp, that is the last earlier number, the original number. And if that is so we print the message Wow, the number is a strong number, right? Otherwise, the else statement is executed with say sorry, the number is not a strong number.

So my dear friends, this program can be asked in your exam. So please try to get to the definition of the word strong number, which says strong numbers and the numbers whose sum of factorial of digits is equal to the origin Number, for example 145. Right. So this is again, good program, important program which executes to that essence of learning.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.