← Back to challenges

Multiplying Numbers in a String

PythonHardlanguage_fundamentalsnumbersstrings

Instructions

Given a string of numbers separated by a comma and space, return the product of the numbers.

Examples

multiply_nums("2, 3") ➞ 6

multiply_nums("1, 2, 3, 4") ➞ 24

multiply_nums("54, 75, 453, 0") ➞ 0

multiply_nums("10, -2") ➞ -20

Notes

Bonus: Try to complete this challenge in one line!

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Compare by ASCII Codes