题目:练习函数调用。
程序分析:使用函数,输出三次 RUNOOB 字符串。
实例
#!/usr/bin/python
# -*- coding: UTF-8 -*-
def hello_runoob():
print ('RUNOOB')
def hello_runoobs():
for i in range(3):
hello_runoob()
if __name__ == '__main__':
hello_runoobs()
以上实例输出结果为:
RUNOOB RUNOOB RUNOOB
本文介绍了如何在Python中定义并调用函数hello_runoob,通过hello_runoobs函数实现三次RUNOOB字符串的输出。当作为主程序运行时,会执行这个循环输出。

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



