← Back to challenges

Adding Numbers with Unknowns

PythonHardmathalgebranumberslogic

Instructions

Create a function that takes a list of numbers with unknowns and returns its sum.

Examples

add(["9", "-8", "8a", "-8a", "9de", "-9de"]) ➞ ["1.0"]

add(["8a", "-7a", "8de", "-7de", "0.1a", "7"]) ➞ ["7.0", 1.1a", "1.0de"]

add(["-7", "7", "8de", "-7de"]) ➞ ["1.0de"]

Notes

Numbers and unknowns will be a string and output should be too.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.