我的主要问题是显示此错误:
TypeError: a float is required
我没有尝试太多,因为我真的不知道自己在做什么,对编码和所有东西都很陌生,所以我希望能就此事提供一些耐心的建议。
from math import sqrt
n = raw_input('Type number here: ')
def square_root(n):
"""Returns the square root of a number."""
square_rooted = sqrt(n)
print "%d square rooted is %d." % (n, square_rooted)
return square_rooted
square_root(n)
我希望能够输入一个数字并显示它的平方根。