Python Question - Add each digit of an integer

Asked 2 years ago, Updated 2 years ago, 23 views

For example, if you have a number of 1,2345 (13,445), I'm going to divide this number by 1+2+3+4+5 (total 15) and add it up, what should I do?

python

2022-09-22 18:07

1 Answers

sum(map(int, list(str(12345))))


2022-09-22 18:07

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.