6 kyu

Float or Integer verifier

364 of 365Good O-man

Description:

Write a function that verifies provided argument is either an integer or a floating-point number, returning true if it is or false otherwise.

Pointers

  • Numeric quantities are signed (optionally when positive, e.g. "+5" is valid notation)
  • Floats less than 1 (not considering possible exponent!) can be written without a leading "0" (e.g. ".00001")
  • Order-of-magnitude (i.e. 10, 100, 1000, etc.) can be written in E notation (the exponent is also signed, optionally so if positive, e.g. all the following are valid 1e2, 1E2, 1e***-2, 1E-2, 1e+***2)
  • Probably obvious, but no spaces are allowed anywhere (we aim to represent a real-life number)
  • You can mix-n'-match any or all above pointers in any single numeric quantity
Regular Expressions
Puzzles

Stats:

CreatedSep 18, 2014
PublishedSep 19, 2014
Warriors Trained782
Total Skips92
Total Code Submissions3212
Total Times Completed365
Python Completions364
Total Stars14
% of votes with a positive feedback rating82% of 117
Total "Very Satisfied" Votes87
Total "Somewhat Satisfied" Votes18
Total "Not Satisfied" Votes12
Ad
Contributors
  • Good O-man Avatar
  • smile67 Avatar
Ad