【发布时间】:2019-03-19 09:52:07
【问题描述】:
运行 Python 程序时,弹出错误“'return' outside function”。
我正在尝试制作一个浮点数列表并返回一个列表,其中每个元素都有 10% 的折扣。
def discount_ten():
nondis=float[1.10,2.40,5.20,6.30,6.70]
for i in nondis:
|return(nondis/10) #<- "|" is the red highlighting.#
print(nondis)
有人可以帮忙吗?
【问题讨论】:
-
这看起来根本不像 Python 代码。
-
@TFX,看看发布的答案是否有帮助?
-
@DirtyBit 非常感谢,它成功了。 c:
标签: python arrays python-3.x list