issubset method
issubset method သည် အစုထဲရှိ element များ အခြား sequence တစ်ခု (ဥပမာ- အခြားအစု၊ list၊ tuple) ထဲတွင် ပါဝင်မှုရှိ/မရှိ စစ်ဆေးပေးပါသည်။ Method သည် boolean တန်ဖိုး - True သို့မဟုတ် False ကို return ပြန်ပေးပါသည်။ Parameter ထဲတွင် ကျွန်ုပ်တို့ နှိုင်းယှဉ်လိုသည့် sequence ကို ထည့်သွင်းပေးရပါမည်။
Syntax
အစု.issubset(sequence)
ဥပမာ
ပထမ အစုထဲရှိ element များ ဒုတိယ အစုထဲတွင် ပါဝင်မှုရှိ/မရှိကို issubset method ဖြင့် စစ်ဆေးကြည့်ပါမည်။
st1 = {'a', 'b', 'c'}
st2 = {'e', 'g', 'a'}
res = st1.issubset(st2)
print(res)
Code run လိုက်သောအခါ ရရှိသော ရလဒ်။
False
ဥပမာ
ယခုတစ်ကြိမ် issubset method ဖြင့် element များ ပါဝင်မှုရှိ/မရှိ ထပ်မံစစ်ဆေးကြည့်ပါမည်။
st1 = {'a', 'b', 'c'}
st2 = {'a', 'b', 'c'}
res = st1.issubset(st2)
print(res)
Code run လိုက်သောအခါ ရရှိသော ရလဒ်။
True
ဥပမာ
အစုထဲရှိ element များကို list ထဲရှိ element များနှင့် နှိုင်းယှဉ်ကြည့်ပါမည်။
st = {'a', 'b', 'c'}
lst = ['a', 'b', 'c']
res = st.issubset(lst)
print(res)
Code run လိုက်သောအခါ ရရှိသော ရလဒ်။
True
ဥပမာ
ယခု အစုထဲရှိ element များကို tuple နှင့် နှိုင်းယှဉ်ကြည့်ပါမည်။
st = {'a', 'b', 'c'}
tlp = ('a', 'b', 'c')
res = st.issubset(tlp)
print(res)
Code run လိုက်သောအခါ ရရှိသော ရလဒ်။
True
ဥပမာ
issubset method တွင် တိုတောင်းသော ပုံစံ (short form) လည်းရှိပါသည်။
st1 = {'a', 'b', 'c'}
st2 = {'a', 'b', 'c'}
res = st1 <= st2
print(res)
Code run လိုက်သောအခါ ရရှိသော ရလဒ်။
True
ဆက်လက်လေ့လာရန်
-
intersectionmethod,
သည် အစုများ၏ ပေါင်းဆုံရာနေရာ (intersection) ကို return ပြန်ပေးပါသည်။ -
differencemethod,
သည် အစုများအကြား ခြားနားချက်များကို return ပြန်ပေးပါသည်။ -
issupersetmethod,
သည် sequence ထဲရှိ element များ အစုထဲတွင် ရှိ/မရှိ စစ်ဆေးပေးပါသည်။ -
symmetric_differencemethod,
သည် အစုနှင့် sequence တို့၏ အခြေခံ element များကို ချန်လှပ် (ဖယ်ရှား) ပေးပါသည်။