每当我编写一个函数然后在Shell中运行它时,它就会变成空白。我只编程了大约一个月,所以不要让事情变得很困难。
我的代码如下所示:
def intro():
print("hello world")
Run Code Online (Sandbox Code Playgroud)
然后,当我运行它时,它。没有弹出消息。除了我的代码中的两行
您编写了一个函数;现在您必须告诉它运行功能!
尝试
def intro(): # <= this tells Python what "intro" means
print("hello, world")
intro() # <= this tells Python to actually do it
Run Code Online (Sandbox Code Playgroud)