I have to write a program sums the numbers of a string.
There's a sample code , I wrote
s = '1.23, 2.12, 3.45'
num1 = [:4]
num2 = [5:9]
num3 = [10:]
sum = num1+ num2+ num3
print sum
But that's not efficient . If I take the string from the user then, How could I write that code where I can separate the numbers from that s individually?