100-053
学习使用按位异或 ^
0^0=0; 0^1=1; 1^0=1; 1^1=0
1 #! /usr/bin/env python 2 # -*- coding:utf-8 -*- 3 ''' 4 学习使用按位异或 ^ 5 0^0=0; 0^1=1; 1^0=1; 1^1=0 6 ''' 7 i = int(input("i:")) 8 j = int(input("j:")) 9 k = i ^ j 10 if i == 0 and j == 0 or i == 1 and j == 1 or i == 0 and j == 1or i == 1 and j == 0: 11 print('K=%d'% k) 12 else: 13 print('输入错误')
浙公网安备 33010602011771号