Skip to content

Commit a13646d

Browse files
sort: better organisation.
program added by me few months ago.
1 parent 1263088 commit a13646d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Diff for: is_number.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# importing the module to check for all kinds of numbers truthiness in python.
2+
import numbers
3+
from math import pow
4+
from typing import Any
5+
6+
# Assign values to author and version.
7+
__author__ = "Nitkarsh Chourasia"
8+
__version__ = "1.0.0"
9+
__date__ = "2023-08-24"
10+
11+
12+
def check_number(input_value: Any) -> str:
13+
"""Check if input is a number of any kind or not."""
14+
15+
if isinstance(input_value, numbers.Number):
16+
return f"{input_value} is a number."
17+
else:
18+
return f"{input_value} is not a number."
19+
20+
21+
if __name__ == "__main__":
22+
print(f"Author: {__author__}")
23+
print(f"Version: {__version__}")
24+
print(f"Function Documentation: {check_number.__doc__}")
25+
print(f"Date: {__date__}")
26+
27+
print() # Just inserting a new blank line.
28+
29+
print(check_number(100))
30+
print(check_number(0))
31+
print(check_number(pow(10, 20)))
32+
print(check_number("Hello"))
33+
print(check_number(1 + 2j))

0 commit comments

Comments
 (0)