how to find strong no. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

how to find strong no.

def strong_num(li): summ=0 for k in li: summ += int(k) print(summ) if summ == num: print("Stonge no.") else: print("not storng no") def fac_num(num): a=[] fac=1 li=[] a= [int(x) for x in str(num)] print(a) for i in a: print(i) for j in range(1,i+1): print(j) fac *=j li.append(fac) print(li) return strong_num(li) num=input("Enter no") fac_num(num) i wrote this code to get strong no. but getting errors.can anybody help me? i am unable to get factorial of 5 I don't know why?

22nd Aug 2021, 12:33 PM
Gouri Shinde
Gouri Shinde - avatar
1 Antwort
+ 6
Gouri Shinde , since it is difficult to explain how to fix your code, i have written something that can do the task. i only have used one function to calculate the factorials and to summarize them. see my comments in the code. any questions are welcome. https://code.sololearn.com/ctm4E7wQiHx7/?ref=app
22nd Aug 2021, 2:42 PM
Lothar
Lothar - avatar