1 2 3 4 5 6 7 8 9 10 | def factorial(x): total = 1 while x>0: total *= x x = x-1 print total return total factorial(4) factorial(5) | cs |
하고 괜히 막 뿌듯했던 factorial
'codeacademy' 카테고리의 다른 글
| 15. Practice Makes Perfect / reverse (0) | 2017.03.28 |
|---|---|
| 15. Practice Makes Perfect / is_prime (0) | 2017.03.28 |
| 15. Practice Makes Perfect / digit_sum (0) | 2017.03.28 |
| 13. Battle ship! (0) | 2017.03.28 |
| 11. Student Becomes the Teacher (0) | 2017.03.28 |
댓글