haxfrrrrrrafd

Cool Math Functions

Oct 21st, 2021
780
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2.  
  3. def add(items):
  4.     sumv = 0
  5.  
  6.     for i in items:
  7.         sumv += i
  8.  
  9.     return sumv
  10.  
  11. def mult(a, b):
  12.     return np.multiply(a, b)
  13.  
  14. def pow(a, b):
  15.     return np.power(a, b)
  16.  
  17. def div(a, b):
  18.     if a > b:
  19.         return np.divide(a, b)
  20.     elif b > a:
  21.         return np.divide(b, a)
  22.     else:
  23.         return 1
  24.  
RAW Paste Data