Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么python ide在代码中没有错误警告时显示空白窗口?_Python_Python 3.x_Python 3.7 - Fatal编程技术网

为什么python ide在代码中没有错误警告时显示空白窗口?

为什么python ide在代码中没有错误警告时显示空白窗口?,python,python-3.x,python-3.7,Python,Python 3.x,Python 3.7,当我用PythonIdle编写代码时,我没有收到错误警告,但是也没有输出。有人可以指导我吗?谢谢 x=0 y=0 def add_numbers(x, y): return x + y add_numbers(1, 2) 我希望3作为答案,但没有任何答案只有空白窗口。目前,数字是从函数返回的-但您没有对结果做任何处理。打印呼叫: print(add_numbers(1, 2)) 或者使用print代替return,并按正常方式调用函数: print(x + y) add_nu

当我用PythonIdle编写代码时,我没有收到错误警告,但是也没有输出。有人可以指导我吗?谢谢

x=0
y=0
def add_numbers(x, y):
    return x + y

add_numbers(1, 2)

我希望3作为答案,但没有任何答案只有空白窗口。

目前,数字是从函数返回的-但您没有对结果做任何处理。
打印
呼叫:

print(add_numbers(1, 2))
或者使用
print
代替
return
,并按正常方式调用函数:

  print(x + y)

add_numbers(1, 2)

这是如何运行的?如果它不在REPL中,您需要打印一些东西来显示它。如果您以python filename.py运行代码,您需要使用
print(添加数字(1,2))
否则如果您在Konsole或ipython中运行它,它将自动打印谢谢您,伙计!!