Hướng dẫn python operator xor - toán tử python xor

Tổng kết và thực hành

Trên đây Kiyoshi đã hướng dẫn bạn cách sử dụng toán tử thao tác bit trong python rồi. Để nắm rõ nội dung bài học hơn, bạn hãy thực hành với các ví dụ sau đây.

Và hãy cùng tìm hiểu những kiến thức sâu hơn về python trong các bài học tiếp theo nhé.

Copy
print["10 | 12 = " + str[10 | 12]]
#>> 10 | 12 = 14

print["10 & 12 = " + str[10 & 12]]
#>> 10 & 12 = 8

print["10 ^ 12 = " + str[10 ^ 12]]
#>> 10 ^ 12 = 6

print["~10 = " + str[~10]]
#>> ~10 = -11

print["11 > 1 = " + str[11 >> 1]]
#>> 11 >> 1 = 5

Viết bởi Kiyoshi. Đã đăng ký bản quyền tác giả tại Creativecommons và DMCA

Bài viết liên quan

  • Chuyển chuỗi thành số trong python

  • Kiểm tra số chẵn lẻ trong python

  • Kiểm tra số đối xứng trong python

  • Kiểm tra số chính phương trong python

  • Kiểm tra số nguyên tố trong python

  • Kiểm tra số nguyên trong python

  • Kiểm tra số hoàn hảo trong python

  • Làm tròn số trong python bằng hàm round

Hãy chia sẻ và cùng lan tỏa kiến thức lập trình Nhật Bản tại Việt Nam!

HOME>> python cơ bản - lập trình python cho người mới bắt đầu>>05. số trong python

Bài sau
Chuyển chuỗi thành số trong python
Bài tiếp
Comment trong java
  • Bài viết mới nhất
  • Làm tròn số trong JavaScript [Math.round, Math.ceil, Math.floor] tháng 7 1, 2022
  • Số mũ trong JavaScript [Math.pow, Math.exp] tháng 7 1, 2022
  • Math.max và Math.min trong JavaScript tháng 7 1, 2022
  • Math.random trong JavaScript tháng 7 1, 2022
  • throw trong JavaScript và cách trả về ngoại lệ tuỳ ý tháng 7 1, 2022
  • Các ngoại lệ trong JavaScript và cách xử lý tương ứng tháng 7 1, 2022
  • try...catch trong JavaScript và cách xử lý ngoại lệ tháng 7 1, 2022
  • Xử lý ngoại lệ của hàm xử lý mô tả trong khối try tháng 7 1, 2022
Profile

Tác giả : Kiyoshi [Chis Thanh]

Kiyoshi là một cựu du học sinh tại Nhật Bản. Sau khi tốt nghiệp đại học Toyama năm 2017, Kiyoshi hiện đang làm BrSE tại Tokyo, Nhật Bản.

var cid = '2352922017'; var pid = 'ca-pub-3861801553502992'; var slotId = 'div-gpt-ad-laptrinhcanban_com-box-1-0'; var ffid = 1; var alS = 1000 % 1000; var container = document.getElementById[slotId]; var ins = document.createElement['ins']; ins.id = slotId + '-asloaded'; ins.className = 'adsbygoogle ezasloaded'; ins.dataset.adClient = pid; ins.dataset.adChannel = cid; ins.style.display = 'block'; ins.style.width = container.offsetWidth + 'px'; ins.style.height = container.offsetHeight + 'px'; container.style.maxHeight = container.style.minHeight + 'px'; container.style.maxWidth = container.style.minWidth + 'px'; container.appendChild[ins]; [adsbygoogle = window.adsbygoogle || []].push[{}]; window.ezoSTPixelAdd[slotId, 'stat_source_id', 44]; window.ezoSTPixelAdd[slotId, 'adsensetype', 1]; var lo = new MutationObserver[window.ezaslEvent]; lo.observe[document.getElementById[slotId + '-asloaded'], { attributes: true }];var cid = '2352922017'; var pid = 'ca-pub-3861801553502992'; var slotId = 'div-gpt-ad-laptrinhcanban_com-box-1-0_1'; var ffid = 1; var alS = 1000 % 1000; var container = document.getElementById[slotId]; var ins = document.createElement['ins']; ins.id = slotId + '-asloaded'; ins.className = 'adsbygoogle ezasloaded'; ins.dataset.adClient = pid; ins.dataset.adChannel = cid; ins.style.display = 'block'; ins.style.width = container.offsetWidth + 'px'; ins.style.height = container.offsetHeight + 'px'; container.style.maxHeight = container.style.minHeight + 'px'; container.style.maxWidth = container.style.minWidth + 'px'; container.appendChild[ins]; [adsbygoogle = window.adsbygoogle || []].push[{}]; window.ezoSTPixelAdd[slotId, 'stat_source_id', 44]; window.ezoSTPixelAdd[slotId, 'adsensetype', 1]; var lo = new MutationObserver[window.ezaslEvent]; lo.observe[document.getElementById[slotId + '-asloaded'], { attributes: true }];var cid = '2352922017'; var pid = 'ca-pub-3861801553502992'; var slotId = 'div-gpt-ad-laptrinhcanban_com-box-1-0_2'; var ffid = 1; var alS = 1000 % 1000; var container = document.getElementById[slotId]; var ins = document.createElement['ins']; ins.id = slotId + '-asloaded'; ins.className = 'adsbygoogle ezasloaded'; ins.dataset.adClient = pid; ins.dataset.adChannel = cid; ins.style.display = 'block'; ins.style.width = container.offsetWidth + 'px'; ins.style.height = container.offsetHeight + 'px'; container.style.maxHeight = container.style.minHeight + 'px'; container.style.maxWidth = container.style.minWidth + 'px'; container.appendChild[ins]; [adsbygoogle = window.adsbygoogle || []].push[{}]; window.ezoSTPixelAdd[slotId, 'stat_source_id', 44]; window.ezoSTPixelAdd[slotId, 'adsensetype', 1]; var lo = new MutationObserver[window.ezaslEvent]; lo.observe[document.getElementById[slotId + '-asloaded'], { attributes: true }];var cid = '2352922017'; var pid = 'ca-pub-3861801553502992'; var slotId = 'div-gpt-ad-laptrinhcanban_com-box-1-0_3'; var ffid = 1; var alS = 1000 % 1000; var container = document.getElementById[slotId]; var ins = document.createElement['ins']; ins.id = slotId + '-asloaded'; ins.className = 'adsbygoogle ezasloaded'; ins.dataset.adClient = pid; ins.dataset.adChannel = cid; ins.style.display = 'block'; ins.style.width = container.offsetWidth + 'px'; ins.style.height = container.offsetHeight + 'px'; container.style.maxHeight = container.style.minHeight + 'px'; container.style.maxWidth = container.style.minWidth + 'px'; container.appendChild[ins]; [adsbygoogle = window.adsbygoogle || []].push[{}]; window.ezoSTPixelAdd[slotId, 'stat_source_id', 44]; window.ezoSTPixelAdd[slotId, 'adsensetype', 1]; var lo = new MutationObserver[window.ezaslEvent]; lo.observe[document.getElementById[slotId + '-asloaded'], { attributes: true }]; .box-1-multi-145{border:none!important;display:inline-block;float:none!important;line-height:0px;margin-bottom:3px!important;margin-left:0px!important;margin-right:0px!important;margin-top:3px!important;max-width:100%!important;min-height:250px;min-width:300px;padding:0;}

Bài Viết Liên Quan

Toplist mới

Bài mới nhất

Chủ Đề