Lendyl

Untitled

Nov 13th, 2025
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | Source Code | 0 0
  1. def add(a : float, b : float) ->float:
  2.     '''Function adds two numbers and returns the sum as a float.'''
  3.     return float(a + b)
  4.  
  5. def sub(a : float, b : float) ->float:
  6.     '''Function subtracts b from and returns the difference as a float.'''
  7.     return float(a - b)
  8.  
  9. def mult(a : float, b : float) ->float:
  10.     '''Function multiplies two numbers and returns the product as a float.'''
  11.     return float(a * b)
  12.  
  13. def div(a : float, b : float) ->float:
  14.     '''Function divides two numbers and returns the quotient as a float.
  15.        It will also check if the divisor is 0 and flag an error and return a
  16.        large negative float if this is true.'''
  17.     try:
  18.         return a / b
  19.     except ZeroDivisionError:
  20.         print("Unable to Divide By Zero")
  21.         return -9999999999999.9
  22.  
  23. def mod(a : float, b : float) ->float:
  24.     return float(a % b)
  25.  
  26. def exp(a : float, b : float) ->float:
  27.     return float(a ** b)
  28.  
  29.  
  30.  
Tags: Boring
Advertisement
Add Comment
Please, Sign In to add comment