pythonExample100/JCP042.py

17 lines
294 B
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

'''
题目学习使用auto定义变量的用法
1.程序分析:      
2.程序源代码:
没有auto关键字使用变量作用域来举例吧
'''
num = 2
def autofunc():
num = 1
print 'internal block num = %d' % num
num += 1
for i in range(3):
print 'The num = %d' % num
num += 1
autofunc()