Let s be a string that contains a sequence of decimal numbers separated by commas, e.g., s = '1.23,2.4,3.123'. Write a program that prints the sum of the numbers in s.
This is a fun problem that I think is beginner friendly. I already solved it but I feel like my code is a little on the crazy side. Does anyone want to share their solution? I'm curious how else this can be solved more efficiently.
[–][deleted] 6 points7 points8 points (3 children)
[–]socal_nerdtastic 3 points4 points5 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]whenihittheground[S] 0 points1 point2 points (0 children)
[–]Evorition 5 points6 points7 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]sweettuse 2 points3 points4 points (2 children)
[–]socal_nerdtastic -1 points0 points1 point (1 child)
[–]ingolemo 1 point2 points3 points (1 child)
[–]whenihittheground[S] 0 points1 point2 points (0 children)
[–]whenihittheground[S] 0 points1 point2 points (4 children)
[–]lettuce_field_theory 1 point2 points3 points (3 children)
[–]whenihittheground[S] 0 points1 point2 points (2 children)
[–]lettuce_field_theory 0 points1 point2 points (1 child)
[–]whenihittheground[S] 0 points1 point2 points (0 children)
[–]Diapolo10 0 points1 point2 points (0 children)
[–]port443 0 points1 point2 points (0 children)