题目:练习函数调用。
练习代码:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def hello_world():
print('hello world')
def three_hellos():
for i in range(3):
hello_world()
if __name__ == '__main__':
three_hellos()
本文通过一个简单的Python脚本示例介绍了如何定义和调用函数。该脚本定义了一个打印'Hello World'的函数,并通过另一个函数三次调用了它。
题目:练习函数调用。
练习代码:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def hello_world():
print('hello world')
def three_hellos():
for i in range(3):
hello_world()
if __name__ == '__main__':
three_hellos()
9117
3445
729
2696

被折叠的 条评论
为什么被折叠?
