Python enumerate() လုပ်ဆောင်ချက်
ဥပမာ
tuple တစ်ခုကို ကိန်းဂဏန်းအရာဝတ္ထုအဖြစ်သို့ ပြောင်းပါ-
x = ('apple', 'banana', 'cherry')
y = enumerate(x)
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
လုပ်ဆောင်ချက်သည် အ enumerate()
စုအဝေးတစ်ခု (ဥပမာ tuple) ကိုယူပြီး ၎င်းကို စာရင်းကောက်သည့်အရာဝတ္ထုအဖြစ် ပြန်ပေးသည်။
လုပ်ဆောင်ချက် သည် enumerate()
စာရင်းသွင်းအရာဝတ္တု၏ သော့အဖြစ် ကောင်တာတစ်ခုကို ပေါင်းထည့်သည်။
အထားအသို
enumerate(iterable, start)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
iterable | An iterable object |
start | A Number. Defining the start number of the enumerate object. Default 0 |