⊗pyPmTpEP 71 of 208 menu

Python တွင် tuple အတွင်း element ရှိမရှိစစ်ဆေးခြင်း

List ထဲမှာ element တစ်ခုရှိမရှိကို operator in ကိုသုံးပြီးစစ်ဆေးနိုင်ပါတယ်။

tpl = ('a', 'b' 'c') res = 'a' in tpl print(res) # ရလဒ်က True ကိုပြသမည်

Element မရှိကြောင်းစစ်ဆေးချင်ရင် operator not in ကိုသုံးရပါမယ်။

tpl = ('a', 'b' 'c') res = 'a' not in tpl print(res) # ရလဒ်က False ကိုပြသမည်

Tuple တစ်ခုပေးထားပါတယ်။

tpl = (2, 4, 6, 10)

အဲဒီထဲမှာ 8 ဆိုတဲ့နံပါတ်ရှိမရှိစစ်ဆေးပါ။

Tuple တစ်ခုပေးထားပါတယ်။

tpl = ('abc', 'def')

အဲဒီထဲမှာ 'd' ဆိုတဲ့ string ရှိမရှိစစ်ဆေးပါ။

အောက်ပါ code ကိုပေးထားပါတယ်။

tpl = ('1', '2', '3') res = 1 not in tpl print(res)

Console မှာဘာထွက်လာမလဲပြောပြပါ။

အောက်ပါ code ကိုပေးထားပါတယ်။

tpl1 = ('ac', '3', 4, 'bd', 5) tpl2 = (1, 2, 3) res1 = 4 in tpl1 res2 = 2 not in tpl2 print(res1) print(res2)

Console မှာဘာထွက်လာမလဲပြောပြပါ။

မြန်မာ
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEnglishEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
ဝက်ဘ်ဆိုက် လုပ်ဆောင်ခြင်း၊ ဆန်းစစ်လေ့လာခြင်းနှင့် ပုဂ္ဂလိကပြုပြင်ခြင်းအတွက် ကျွန်ုပ်တို့သည် cookie များကို အသုံးပြုပါသည်။ ဒေတာများကို ပြုပြင်ခြင်းသည် ကိုယ်ရေးကိုယ်တာ မူဝါဒအတိုင်း ဖြစ်ပါသည်။
အားလုံးလက်ခံရန် ပြင်ဆင်ရန် ငြင်းပယ်ရန်