+ 2

[Challenge] Python Factorial

The factorial of a number is represented as: n! = n * (n-1) * (n-2) ... * 1 Example: 3! = 3 * 2 * 1 = 6 In 4 lines or less of Python, write a code without using any modules (your OWN code) to find the factorial of any given number. Here is my code for reference: https://code.sololearn.com/ceW6oRZBSjCE/?ref=app Good Luck!

22nd May 2018, 2:39 PM
Nathan Lewis
Nathan Lewis - avatar
4 ответов
+ 23
If u can accommodate Ruby... here's Ruby 1 Liner...👇 https://code.sololearn.com/cOO78cCUdxgN/?ref=app
22nd May 2018, 3:05 PM
🌛DT🌜
🌛DT🌜 - avatar
+ 5
https://code.sololearn.com/cb60vmKFbNLk/?ref=app
22nd May 2018, 3:41 PM
Louis
Louis - avatar
+ 3
My try: https://code.sololearn.com/c0k034bpqK9N/?ref=app It's 5 lines though.... 😬😬😬 EDIT: Now it's 4 lines 🙃
22nd May 2018, 2:52 PM
Paul Grasser
Paul Grasser - avatar