Posts by Alex Sandro R Gomes • 11 points
1 post
-
1
votes4
answers15696
viewsA: How to extract digits from a Python string and add them together?
fim=int(input("Digite o valor de n: ")) string = str(fim) soma = 0 for ch in string: if ch.isdigit(): soma += int(ch) print(soma) …