pythonExample100/JCP051.py

13 lines
223 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.

'''
【程序51】
题目:学习使用按位与 & 。   
1.程序分析0&0=0; 0&1=0; 1&0=0; 1&1=1
2.程序源代码:
'''
if __name__ == '__main__':
a = 077
b = a & 3
print 'a & b = %d' % b
b &= 7
print 'a & b = %d' % b