Chinaunix首页 | 论坛 | 博客
  • 博客访问: 392432
  • 博文数量: 199
  • 博客积分: 154
  • 博客等级: 入伍新兵
  • 技术积分: 1530
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-14 08:43
文章分类

全部博文(199)

文章存档

2015年(101)

2014年(97)

2011年(1)

分类: Python/Ruby

2014-10-25 16:24:14

# -*- coding: UTF-8 -*-
'''
【程序34】
题目:练习函数调用
1. 程序分析: 
2.程序源代码:
'''
def hello_world():
    print ('hello world')

def three_hellos():
    for i in range(3):
        hello_world()
if __name__ == '__main__':
    three_hellos()
在if __name__ == "__main__":之后的语句作为模块被调用的时候,语句之后的代码不执行;直接使用的时候,语句之后的代码执行
阅读(529) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~