Set in the python

programming May 31, 2017

Hello everyone, I have problem about compare 2 list and found solution to solve this with set.

Introduction

union for find all content in list a and b -> set(a) | set(b)
intersection for find same content in list a and b -> set(a) & set(b)
complement for find all content in a but not in b -> set(a) — set(b)
subset for find all content from a in b -> set(a).issubset(set(b))

then should be convert list to set :)

Tags

Minseo Chayabanjonglerd

Android Developer ผู้เป็นเจ้าของบล็อก MikkiPastel ที่ชอบทำหลายๆอย่างนอกจากเขียนแอพแอนดรอยด์ เช่น เขียนบล็อก เขียนแชทบอท เรียนออนไลน์ อ่านหนังสือ วาดรูปเล่น ดู netfilx สั่งอาหารอร่อยๆกัน เป็นต้น