我一直试着寻找答案,但是这里的问题似乎是先进的(我是Python的新手),或者是因为重新定义了我在剧本中无法捕捉到的东西.这是代码 -
a = float(input("Enter the length(in inches)"))
b = float(input("Enter the width(in inches)"))
print ()
print ("The area of your shape is: "(a*b))
Run Code Online (Sandbox Code Playgroud)
我收到错误TypeError:'str'对象不可调用.
我知道这是一个简单的脚本,但它正在进行中.
我有一个我之前写过的脚本,现在正在尝试创建一个主页来运行这个脚本和其他脚本.我知道我必须把它变成一个函数然后在nesicary时调用它但我在函数部分遇到了一些麻烦.非常感谢任何帮助和建议.下面是我引用的脚本.
#A Python math script
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
print "Your answer is: ",(a*b)
Run Code Online (Sandbox Code Playgroud)