File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 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 ))
You can’t perform that action at this time.
0 commit comments