首先,我是 Julia 的新手,所以我还在适应这门语言。
我正在使用 Jupyter,并且正在尝试添加“SpecialPolynomials”。这是我不断得到的:
using Pkg
Pkg.add("SpecialPolynomials")
______________________________________________________________________________________________________________________________________________________________________________________
Resolving package versions...
Unsatisfiable requirements detected for package SpecialFunctions [276daf66]:
SpecialFunctions [276daf66] log:
??possible versions are: [0.7.0-0.7.2, 0.8.0, 0.9.0, 0.10.0-0.10.3] or uninstalled
??restricted by julia compatibility requirements to versions: [0.7.0-0.7.2, 0.8.0] or uninstalled
??restricted by compatibility requirements with SpecialPolynomials [a25cea48] to versions: [0.9.0, 0.10.0-0.10.3] — no versions left
??SpecialPolynomials [a25cea48] log:
??possible versions are: 0.1.0 or uninstalled
??restricted to versions * by an explicit requirement, leaving only versions 0.1.0
Stacktrace:
[1] …Run Code Online (Sandbox Code Playgroud) 正在解决算法问题,必须颠倒列表。完成后,我的代码如下所示:
def construct_path_using_dict(previous_nodes, end_node):
constructed_path = []
current_node = end_node
while current_node:
constructed_path.append(current_node)
current_node = previous_nodes[current_node]
constructed_path = reverse(constructed_path)
return constructed_path
Run Code Online (Sandbox Code Playgroud)
但是,一路上,我尝试了一下,return constructed_path.reverse()发现它没有返回列表......为什么会这样?
我应该能够直接返回反向列表,而不需要先执行list.reverse()or ,这难道不有意义吗list = reverse(list)?