【发布时间】:2021-11-24 21:28:44
【问题描述】:
def cylinder():
r = int(input("Radius = "))
h = int(input("Height = "))
s = 2 * 3.14 * r * h
if input("Do you want to know full area? [y/n]: ") == "y":
s += 2 * circle(r)
print(s)
def circle(r):
s1 = 3.14*r*r
cylinder()
这是我的代码,我有错误:
File "C:\Users\Good dogie\Desktop\python-work\main.py", line 187, in <module>
cylinder()
File "C:\Users\Good dogie\Desktop\python-work\main.py", line 182, in cylinder
s += 2 * circle(r)
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
我了解错误的含义,但我不知道如何解决此问题。如果有人可以给我小费,我将不胜感激。
【问题讨论】:
-
circle() 隐式返回 None