from typing import Union
import math


print(dir(math),'\n')
print(f'math.exp (for example):\n'
      f'{math.exp(-3.4060*(10**(-4))):.5f}\n')


def exp_func(number: Union[int, float]) -> Union[int, float]:
    
    '''Exponential function
with exception handling,
return integer or float
'''
    
    try:
        if isinstance(number, int) or isinstance(number, float):
            return round(math.exp(number), 5)
        else:
            raise ValueError('Number must be an integer or float')
    except ValueError as V:
        return f'Error!!!\n{V}'
        
        
        
print(f'exp_func:\n'
      f'{exp_func(-3.4060*(10**(-4)))}\n')
print(exp_func('2'), '\n')

ef1 = exp_func(-6.3445/10000)
print(f'x = {ef1}\n'
      f'square root of \'x\' = {math.sqrt(ef1):.5f}\n')

print(exp_func.__doc__)

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: