100-054
取一个整数a从右端开始的4〜7位。
1 #! /usr/bin/env python 2 # -*- coding:utf-8 -*- 3 ''' 4 取一个整数a从右端开始的4〜7位。 5 ''' 6 if __name__ == '__main__': 7 a = int(input('input a number:')) 8 b = a >> 4 9 c = ~(~0 << 4) 10 d = b & c 11 print ('%o\t%o' %(a,d))
xliaoe at 111 dot com ; 返回顶部