>>> problem = '''Bobby has 3 times the number of apples as Chris has.
Bob has 10 more apples than Bobby has.
Christopher has 10 more apples than Chris has.
Bob has 2 times the number of apples as Christopher has.'''
结果以秒为单位:
>>> res = client.query(problem)
>>> for pod in res.pods:
... if pod.title == 'Results':
... print pod.text
...
Bob has 40 apples.
这里也有方程式:
>>> for pod in res.pods:
... if pod.title == 'Equations with variables':
... for i in pod:
... print i.text
...
bobb = 3 × chris
bob = bobb+10
christ = chris+10
bob = 2 × christ
爸爸叫鲍勃,儿子叫克里斯托弗。我认为最适合您的解决方案是Wolfram | Alpha alonside,它有非常简单的Python API:
这当然需要wolframalpha package installed。你知道吗
下面一行假设您有自己的Wolfram|Alpha API AppID。Read more about terms of use in your applications。你知道吗
现在我们可以用苹果的语言来定义我们的问题。我们假设鲍比比比鲍伯小10岁,克里斯和克里斯托弗也一样。你知道吗
结果以秒为单位:
这里也有方程式:
其中
bobb
表示10年前的鲍勃(Bobby),chris
表示10年前的克里斯托弗(Christopher),bob
表示鲍勃,christ
表示克里斯托弗(10年后)。你知道吗祝你好运,玩得开心!你知道吗
相关问题 更多 >
编程相关推荐