python代码中的字符串到浮点转换错误

python代码中的字符串到浮点转换错误,python,string,type-conversion,Python,String,Type Conversion,我得到以下转换错误,不确定实际问题在哪里 运动: 编写一个函数,该函数接受两个正整数,即矩形的高度和宽度,并返回包含该矩形面积和周长的列表。 def Area_of_a_Rectangle(width, height): '''Calculate the area''' Area = width * height # calculate the Perimeter''' Perimeter = 2 * (width + height) print("\n

我得到以下转换错误,不确定实际问题在哪里

运动: 编写一个函数,该函数接受两个正整数,即矩形的高度和宽度,并返回包含该矩形面积和周长的列表。

def Area_of_a_Rectangle(width, height):
    '''Calculate the area'''
    Area = width * height

    # calculate the Perimeter'''
    Perimeter = 2 * (width + height)
    print("\n Area of a Rectangle is: ",Area)
    print(" Perimeter of Rectangle is: ",Perimeter)

width = float(input("Please Enter the Width of a Rectangle: "))  # This line errs out.
height = float(input("Please Enter the Height of a Rectangle: "))
Area_of_a_Rectangle(width, height)

**Error:**
Error in executing student function:
ValueError at line 11
could not convert string to float: 

问题在于输入的值。如果输入数值,第11行不应给出该错误。

欢迎访问stackoverflow.com。请花些时间阅读,特别是命名和。另外,请和。关于您的,请不要使用行号。如果您想标记出一个特定的行,那么在显示的代码中添加注释。另外,请阅读,了解如何正确格式化代码片段。现在,请编辑您的问题以改进它。代码在空闲状态下运行良好,但在我的python课程网站的编辑器中,相同的代码出现错误。也许它们是关于使用
int
s而不是
float
s的特定代码?只是一个猜测,我可能不知道别人的程序(那个网站)在做什么。