#split the equation into 2 parts using the = sign as the divider, parse, and turn into an equation sympy can understand
equation = Eq(parse_expr(<input string>.split("=")[0]), parse_expr(<input string>.split("=")[1]))
answers = solve(equation)
#check for answers and send them if there are any
if answers.len == 0:
response = "There are no solutions!"
else:
response = "The answers are "
for answer in answers:
response = response + answer + ", "
response = response[:-2]
await self.client.send(response, message.channel)
Run Code Online (Sandbox Code Playgroud)
我试图制作一个使用 sympy 来解决代数的不和谐机器人,但我一直遇到上述实现的错误。有人可以帮忙吗?
但是对于输入 …