alex-bn-lee

【398】COMP9021 - Polynomial

构建 Polynomial 类,实现 +, -, *, / and +=, -=, *=, /=

参考:如何用python编程求解二元一次方程组。如x+y=3;x-y=1
参考:python对重载运算符的限制
参考:python:自定义对象的打印

operator overwrite
+
_add_
- _sub_
* _mul_
/ _truediv_
+= _iadd_
-= _isub_
*= _imul_
/= _itruediv_
字符串打印 _str_

改写举例:

def __add__(self, other):
    ...
    return Polynomial(self.ex + other.ex)

def __iadd__(self, other):
    return Polynomial(self.ex) + Polynomial(other.ex)

分类:

技术点:

相关文章:

  • 2021-07-19
  • 2021-10-20
  • 2021-06-08
  • 2021-04-20
  • 2021-10-10
  • 2021-09-26
  • 2021-09-09
  • 2021-12-05
猜你喜欢
  • 2021-07-09
  • 2021-10-23
  • 2021-07-29
  • 2022-01-15
  • 2021-12-06
  • 2021-11-06
  • 2021-11-14
相关资源
相似解决方案