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('输入错误')

 

posted @ 2018-05-17 19:08  睡到自然醒的猪  阅读(93)  评论(0)    收藏  举报

xliaoe at 111 dot com ; 返回顶部