为什么我会收到错误^ SyntaxError:无效的语法?我输入正确吗?

时间:2020-03-31 16:05:33

标签: python python-3.x

if shape_b=="CUBE":
    a=int(input("Please enter the measure of the edge of cube"))
    volume=a*a*a
    TSA=6a*a
    CSA=4a*a
    print(f"Volume of cube is {str(volume)}. TSA is {str(TSA)}. CSA is str{CSA}")`

错误; TSA = 6a * a ^ SyntaxError:语法无效

请帮帮我。

2 个答案:

答案 0 :(得分:0)

您犯了一个小错误。 6a*a替换为6*a*a

if shape_b=="CUBE":
    a=int(input("Please enter the measure of the edge of cube"))
    volume=a*a*a
    TSA=6*a*a
    CSA=4*a*a
    print("Volume of cube is {}. TSA is {}. CSA is {}".format(volume, TSA, CSA))

答案 1 :(得分:0)

我认为您打算这样做:

TSA=6*a*a
CSA=4*a*a
相关问题