Python 无效语法(字符串和浮点复杂度!)

Python 无效语法(字符串和浮点复杂度!),python,Python,我似乎无法理解这一点。非常感谢您的帮助 pitcherSpeed=float(round((40908/tempSpeed),2)) output=output+tempPitcher+ "\t" +str(round(float(tempSpeed), 2)) + "\t" +str(round(float(pitcherSpeed), 2)) +"\n" 我对以上两行有意见。不管我做什么来改变他们。他们犯了错误。我需要一些帮助来确定他们到底出了什么问题 以下是我的所有代码(如果需要): 我

我似乎无法理解这一点。非常感谢您的帮助

pitcherSpeed=float(round((40908/tempSpeed),2))
output=output+tempPitcher+ "\t" +str(round(float(tempSpeed), 2)) + "\t" +str(round(float(pitcherSpeed), 2)) +"\n"
我对以上两行有意见。不管我做什么来改变他们。他们犯了错误。我需要一些帮助来确定他们到底出了什么问题

以下是我的所有代码(如果需要):

我收到错误消息: 回溯(最近一次呼叫最后一次): 文件“C:/Users/whitney.meulink/Desktop/programpractice.py”,第17行,在 投手速度=浮动(圆形((40908/tempSpeed),2)) TypeError:/:'int'和'str'的操作数类型不受支持。

行:

pitcherSpeed=float(round((40908/tempSpeed),2)
缺少一个结束括号

pitcherSpeed=float(round((40908/tempSpeed),2))

通常情况下,错误出现在前一行。

请显示完整的错误消息。即使不检查,初学者代码中最常见的语法错误之一是由于括号不平衡造成的。因此,从Python抱怨的那一行开始,在代码中向上移动,直到最后找到一个被遗忘的括号(通常是
。)回溯(最后一次调用):文件“C:/Users/whitney.meulink/Desktop/programpractice.py”,第16行,pitchrspeed=float(round((40908/tempSpeed),2))TypeError:/:“int”和“str”的操作数类型不受支持,请参见上面的错误消息。对不起打扰你了,我想我就是不知道怎么做才行!好的,我保证再问一个问题P回溯(最后一次调用):文件“C:/Users/whitney.meulink/Desktop/programpractice.py”,第17行,在output=output+tempPitcher+“\t”+str(round(float(tempSpeed)),2)+“\t”+str(round(float(pitchrspeed)),2)+“\n”类型错误:str()参数2必须是str,而不是int
str(round(float(pitchrspeed),2))
Gosh现在返回到:Traceback(最近一次调用最后一次):文件“C:/Users/whitney.meulink/Desktop/programmapractice.py”,第16行,在pitchrspeed=round((40908/float(tempSpeed)),2)ValueError:无法将字符串转换为float:
tempSpeed
无法容纳您期望的内容<代码>打印(tempSpeed)在错误前的行上,确保它看起来像一个数字。
pitcherSpeed=float(round((40908/tempSpeed),2))