Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import print_function
- from calc import calc
- from calc import oper2
- from calc import calcerr
- class notebook(calc):
- def add_cust_func(self, func, key, num_args=1):
- self.operations_list[key]=operator(func,num_args=numargs)
- def power(arg1,arg2):
- return arg2**arg1
- def gaussian(x,u=0.0,std=1.0):
- import math
- return math.exp((x-u)/(2*std**2))/math.sqrt(2*math.pi*std**2)
- print("calc")
- calc1 =notebook()
- calc.add_custom("operators.json")
- calc.add_cust_func(power, '**',num_args=2)
- calc.add_cust_func(gaussian, 'gauss',num_args=3)
- calc.add_cust_func(r_func,'4th',num_args=1)
- calc.print_oper()
- while True:
- user = input("")
- if user == 'q':
- break
- try:
- calc.addto_q(user)
- except calcerr as Error:
- print('error', Error)
- calc.print_q()
- calc
- ---------------------------------------------------------------------------
- TypeError Traceback (most recent call last)
- <ipython-input-46-21026436a7f6> in <module>()
- 16 print("calc")
- 17 calc1 =notebook()
- ---> 18 calc.add_custom("operators.json")
- 19 calc.add_cust_func(power, '**',num_args=2)
- 20 calc.add_cust_func(gaussian, 'gauss',num_args=3)
- TypeError: add_custom() missing 1 required positional argument: 'filename'
Add Comment
Please, Sign In to add comment