1 2 3 4 5 6 7 8 | def digit_sum(n): total = 0 for i in str(n): total +=int(i) return total print digit_sum(1234) | cs |
str함수와 int함수도 자꾸 남의 답안을 베끼다보니
익숙해진다
'codeacademy' 카테고리의 다른 글
| 15. Practice Makes Perfect / is_prime (0) | 2017.03.28 |
|---|---|
| 15. Practice Makes Perfect / factorial (0) | 2017.03.28 |
| 13. Battle ship! (0) | 2017.03.28 |
| 11. Student Becomes the Teacher (0) | 2017.03.28 |
| 10. A Day at the Supermarket / Stocking Out (0) | 2017.03.28 |
댓글