Hello,
I am trying to work my way through some practice exercises where the objective is to convert a string containing numbers, so that I am able to multiply those numbers to each other. A key requirement is that whenever there is a zero that number gets skipped.
For example, if I have the string “123405”, the multiplication would look like this: 1*2*3*4*5 yielding 120.
My problem isn’t so much the if statement, as much as how to convert the string to an integer or float and then parse this to a series of numbers that I can multiply.
Could you please provide pointers or suggestions on how to approach this problem?
Thank you!
I am trying to work my way through some practice exercises where the objective is to convert a string containing numbers, so that I am able to multiply those numbers to each other. A key requirement is that whenever there is a zero that number gets skipped.
For example, if I have the string “123405”, the multiplication would look like this: 1*2*3*4*5 yielding 120.
My problem isn’t so much the if statement, as much as how to convert the string to an integer or float and then parse this to a series of numbers that I can multiply.
Could you please provide pointers or suggestions on how to approach this problem?
Thank you!