Why does this return None?

廉价感情. 提交于 2021-02-17 06:28:35

问题


I'm testing out repl.it (running Python 3.5.1) and I noticed that after every line of input into the console, the console replies with None. I'm not using any fancy definitions with forgotten return values, this happens even after assignment statements. What is going on here?

Example:

x,y,z=1,2,3
=> None
print(x+y+z)
6
=> None

回答1:


None is the default return value of statements that do not have a return value. Some interpreter shells display it, some don't.

It's perfectly normal, don't worry about it.



来源:https://stackoverflow.com/questions/38747994/why-does-this-return-none

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!