YouTip LogoYouTip

Python Exercise Example52

# Python2.x Python Exercise Instance 52 [![Image 3: Python 100 Examples](#) Python 100 Examples](#) **Question:** Learn to use the bitwise OR | . **Program Analysis:** 0|0=0; 0|1=1; 1|0=1; 1|1=1 ## Instance(Python 2.0+) ```python #!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == ' __main__ ': a = 0o77 b = a | 3 print('a | b is %d' % b) b |= 7 print('a | b is %d' % b) The output of the above instance is: a | b is 63 a | b is 63 [![Image 4: Python 100 Examples](
← Python Exercise Example53Python Exercise Example51 β†’