我刚开始学习Python。由于这是我的第一语言,如果这太容易了,请不要对我苛刻。我不知道如何解决这个问题。这是我编程的:
a=input("Enter pyramid base size ")
H=input ("Enter pyramid height size ")
P=a*a+2*a*h
print (P)
但这出来了:
Enter pyramid base size 2
Enter pyramid height size 2
Traceback (most recent call last):
File "D:\Program Files (x86)\Python\pyramid.py", line 3, in <module>
P=a*a+2*a*h
TypeError: can't multiply sequence by non-int of type 'str'