# What's a number? [duplicate]

Similar to What's a string?

If a challenge says that the input will be “a number”, what data types are acceptable?

Obviously, types like int and float are numeric.

What about strings? Command-line arguments and stuff read from standard input will naturally be string or sequence-of-char objects, so we'll have to accept string input in those cases. But do we accept strings as function arguments, if the language has dedicated data types for representing numbers?

What about lists of digits, like representing 12345 as [1, 2, 3, 4, 5] (list of digits as numbers) or ['1', '2', '3', '4', '5'] (list of digits as char/string)?

Edit: No, I don't think this is a duplicate of Default for Code Golf: Input/Output methods. That question's answers focus on where the input can come from: From command-line arguments, from a file, from a GUI input box, etc. Whereas my question is about what type of input should be acceptable.

• The standard IO formats have a lot to do with what types input can be as well as where it can come from.
– Jo King Mod
Sep 18 '19 at 3:11
• I've posted an answer to the default IO formats question regarding taking numbers as a string and vice-versa
– Jo King Mod
Sep 18 '19 at 3:24
• Sep 18 '19 at 10:18
• Sep 18 '19 at 10:20
• I would disagree regarding your edit, as for example allowing stdin for numeric input implies allowing a conversion to characters. Sep 18 '19 at 10:21