所以我做了一个函数,并想为其添加注释,但编译器一直给我一个错误:
def square_root(x:number, eps:number) -> float:
pass
Run Code Online (Sandbox Code Playgroud)
编译器返回如下:
File "/Users/albertcalzaretto/Google Drive/CSC148H1/e1/e1a.py", line 1
def square_root(x, eps) -> float:
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我从未使用过函数注释,并且阅读了一些有关它的资料,并且我不认为我所做的事情是错误的。