Does a Number Exist?

Published by Matt in

Create a function which validates whether a given number exists, and could represent a real life quantity. Inputs will be given as a string.

Examples

valid_str_number("3.2") ➞ true

valid_str_number("324") ➞ true

valid_str_number("54..4") ➞ false

valid_str_number("number") ➞ false

Notes

Accept numbers such as .5 and 0003.

Watch a quick demo on how Edabit works.