+ 1

I need help for my coding exercice

In this programm i has to calculate n! Where n is a variable of type int. Can someone help me please? n=... Factorial=... For i in range(...): ....... Print(...)

15th Oct 2019, 7:56 PM
_C1B3R_
_C1B3R_ - avatar
3 Antworten
+ 3
iterative: n = int(input("n: \n")) fac = 1 for i in range(2, n): fac *= i print(str(n) + "! = " + str(fac)) recusive: def fac(n): if n == 0: return 1 else: return n * fac(n-1) n = int(input("n: \n")) print(str(n) + "! = " + str(fac(n)))
15th Oct 2019, 8:04 PM
Anton Böhler
Anton Böhler - avatar
0
Thank you so much !
16th Oct 2019, 5:50 AM
_C1B3R_
_C1B3R_ - avatar
0
If you want to enhance your coding skills then you can go for Data Analytics with Python. With the help of this course you can enhance your knowledge in ML, Data Analytics,Data Science etc. For more check this link: https://www.cetpainfotech.com/technology/data-analytics-using-python-training
16th Oct 2019, 7:18 AM
Kritesh Anand
Kritesh Anand - avatar