Skip to playerSkip to main contentSkip to footer
  • 5/17/2025
Lists are mutable and dynamic; list items can be added, removed or changed after the list is defined. Lists are ordered; newly added items will be placed at the end of the list. Lists use zero-based indexing; every list item has an associated index, and the first item's index is 0. Duplicated list items are allowed.

Category

📚
Learning
Transcript
00:00hola guys and girlies welcome back or good morning
00:06this lecture in this lecture we are going to list methods
00:11when we talk about strings we have told you that
00:15function we use function b and method b
00:21and we have seen some of the functions
00:25and we use them right at this link
00:29you can remember however
00:31i have a good idea
00:33i have a good idea
00:35i have a good idea
00:37i have a good idea
00:41show you
00:43these methods
00:45basically
00:46list
00:47call
00:49list
00:50most used methods
00:52in this lecture
00:54first
00:55list
00:57create
00:58i have a good idea
00:59i have a good idea
01:01i have a good idea
01:03and
01:04this list
01:05if we have a good idea
01:07we can make value
01:08insert
01:09how to do
01:10so
01:11we can make a method
01:12exist
01:13and
01:14it is
01:15insert
01:16I press the dot and then you will see the methods already
01:22I will see the available methods.
01:24I will see the insert, index and object.
01:28I press the insert and I will see the index.
01:34Let's say, I want to remove orange.
01:36Orange is the index.
01:38Zero, one and two.
01:40In the two, I will see the object.
01:44Let's say, I will see the mango.
01:46And the two, I will see the object.
01:48Now, I will print and print and print.
01:54We will print the shopping cart.
01:56And I will do it.
02:00As you can guess,
02:02you can insert the mango on two locations.
02:06And orange is the shift.
02:08Excellent!
02:10Now, you can insert the object itself.
02:14self ہے یہ
02:15کوئی value return نہیں کرتا
02:18مثال کے طور پہ اگر میں اس کو
02:19new list کو assign کر دوں اور میں
02:21کہوں یہ دیکھئے new underscore list
02:24is equal to shopping card
02:25اور یہاں پہ new list کو print کر آؤں
02:27تو آپ دیکھیں گے کہ new list
02:29ہمیں کچھ بھی نہیں دے گا
02:30new underscore list
02:33میں اس کو execute کرتا ہوں
02:34and you will see none
02:36اور اس none کی reason یہ ہے
02:38کہ یہ basically original list
02:40کے اندر change ہو رہی ہے
02:41new list کو کچھ بھی assign نہیں ہو رہا
02:44کیونکہ یہ کچھ return نہیں کر رہا یہ function
02:46اب اس کے بارے میں سیکھیں گے کہ یہ function
02:48return کیوں نہیں کر رہا اور return کیا چیز ہے
02:50لیکن فلحال آپ یوں سمجھ دیجئے
02:52یہ کچھ واپس نہیں کر رہا اور original list میں change کر رہا
02:55اوکے
02:56تو چلیئے اس طرح کرتے ہیں
02:57کہ کچھ اور methods سیکھتے ہیں
03:00اور کیا کر سکتے ہیں ہم اس کے ساتھ
03:02مثال کے طور پہ یہ دیکھیں میں یہاں پہ اس کو رکھ لیتا ہوں
03:04اس کے بعد ہے ایک function
03:06جو کہ basically
03:08ہم append کر سکتے ہیں
03:09using this function
03:11اب append کرنا ہے تو object بتانا ہے
03:13اس کو let's say میں کہتا ہوں
03:14ایک اور object ڈالنا ہے
03:18let's say laptop
03:19ٹھیک ہے
03:21اب جو append ہے automatically
03:23جہاں پہ list ختم ہوتی ہے
03:25اس کے آگے وہ element append کر دیتا ہے
03:28ٹھیک ہے
03:29اب ذرا میں اس کو again
03:31اس چیز کو ہم comment out کر دیتے ہیں
03:33ٹھیک ہے
03:34ٹھیک ہے
03:35اب میں اس کو run کرتا ہوں
03:37اس کی ضرورت نہیں رہی
03:38اور اس کو execute کرتے ہیں
03:40as you see
03:41laptop جو ہے
03:42list کے end کے اوپر add ہو گیا ہوگا ہے
03:44again
03:45just like the previous example
03:47کیونکہ
03:49اس میں کچھ return نہیں ہوا
03:51so this also does not return anything
03:53ٹھیک ہے
03:54اچھا اس کے ساتھ
03:56append کے ساتھ
03:56آپ اس کو remove کر سکتے ہیں
03:58اب remove کے لیے
04:00آپ نے
04:01basically
04:02value بتانی ہوتی ہے
04:06کہ کون سی value
04:07آپ نے remove کرنی ہے
04:08مثال کے طور پر
04:09میں چاہتا ہوں
04:10کہ orange remove ہو جائے
04:11تو میں یہاں پہ
04:12orange replace کرتا ہوں
04:13ٹھیک ہے
04:14of course in single quotation
04:16جو کہ string کی example ہے
04:18جو کہ string کی indication ہے
04:20اور میں اس کو execute کرتا ہوں
04:21as you see
04:23orange is no more
04:24by the way
04:25وہ جو mango تھا
04:27وہ basically
04:27original list کا حصہ نہیں تھا
04:31وہ ڈالا
04:31اور
04:32اس case میں آپ کو
04:33یہاں پہ نظر نہیں آیا
04:34ٹھیک ہے
04:35again
04:36یہ جو remove ہے
04:38یہ بھی کچھ نہیں return کرتا
04:40اگر آپ یہاں پہ آئے نا
04:41اور یہاں پہ اس کو
04:42assign کریں
04:43new list کو
04:44اور new list کو print کریں
04:46so you will see none
04:47ٹھیک ہے یہ
04:49میں یہاں پہ
04:49new list
04:50print کرنے لگوں
04:51execute کرتے ہیں
04:54اور new list آپ کو
04:55none return کریے
04:57کیونکہ
04:58in itself
04:59remove جو ہے
05:00وہ کچھ بھی return نہیں کرتا
05:01اچھا
05:03اب
05:03what if
05:05میں کوئی
05:09item
05:10last item
05:11for example
05:11اگر نکالنا چاہتا ہوں
05:12تو اس case میں
05:13ایک اور method
05:14exist کرتا ہے
05:15جس کو کہتے ہیں
05:15pop method
05:16ٹھیک ہے
05:17تو یہ
05:17basically کیا کرتا ہے
05:18last value
05:19pop کر دیتا
05:19اگر آپ اس کو
05:20کوئی index
05:21نہ دیں یہاں پہ
05:22تو یہ دیکھیں
05:22میں اس کو execute
05:23کرتا ہوں
05:24تو last value
05:25بنانا تھی
05:25remove
05:26ہم نے orange
05:27remove
05:28بتا کے کیا
05:29کہ orange نہیں چاہیے
05:30pop سے ہم نے کہا
05:31کہ ہمیں
05:31last element نہیں چاہیے
05:32جو کہ بنانا تھا
05:33وہ remove ہو گیا
05:34جب ہم نے list
05:35print کی تو
05:35اس میں صرف
05:35choose رہ گئے
05:36ٹھیک ہے
05:37اچھا
05:38اب pop کو آپ
05:40index بھی دے سکتے ہیں
05:45اور original list
05:47پہلے دیکھتے ہیں
05:48ہماری original list
05:49کیا ہے
05:49میں run کرتا ہوں
05:50تو original list
05:50کے اندر
05:51تین item پڑے ہوئے
05:52اب دیکھئے
05:53اگر pop کو
05:53میں کہتا ہوں
05:54کہ zeroth
05:55index کے اوپر
05:55item کو
05:56pop کرنا ہے
05:57تو یہ دیکھئے
05:58جو shoes تھا
05:59وہ basically
05:59remove ہو گیا ہوئا ہے
06:00کیونکہ shoes
06:01zero index کے اوپر
06:02پڑا ہوئا ہے
06:02جس کا مطلب یہ ہے
06:04کہ ہم اس کو
06:04index بھی دے سکتے ہیں
06:05اس element کا
06:07جس کو ہم
06:07pop کرانا چاہتے ہیں
06:09ٹھیک ہے
06:09لیکن remove کی
06:11خاصیت یہ ہے
06:11کہ اس میں
06:12ہمیں اس
06:12element کو
06:14جس کو ہمیں
06:14remove کرنا پڑتا ہے
06:15اس کا نام
06:17بتانا پڑتا ہے
06:18اور again
06:21just like
06:21older example
06:22یہ جو
06:23pop ہے
06:23basically
06:24یہ آپ کو
06:25جو آپ
06:27item pop
06:28کرانا چاہتے ہیں
06:29یہ وہ
06:30item return
06:31کرتا ہے
06:31unlike other
06:33ٹھیک ہے
06:33unlike other
06:34مجھے نہیں
06:34کہنا چاہیے تھا
06:35just like other
06:35unlike other
06:37مثال کے طور پر
06:38یہ دیکھئے
06:38میں یہاں پہ
06:39کہتا ہوں
06:39let's say
06:40new
06:41underscore
06:42list
06:43is equal
06:44to this
06:44thing
06:44اور اگر
06:45میں print
06:45کرتا ہوں
06:46تو جو
06:47item ہم
06:47pop
06:47کرا رہے ہیں
06:48وہ
06:49new list
06:49کو
06:49assign
06:50ہو جاتا ہے
06:50تو اب
06:51ذرا
06:51آپ نے
06:51غور
06:52کرنا ہے
06:52کہ
06:52pop
06:53ہم
06:53کرا رہے ہیں
06:53shoes
06:54ٹھیک ہے
06:54میں اس
06:54کو
06:55execute
06:56کرتا ہوں
06:57as you
06:58see
06:59جو
06:59new list
07:00ہے
07:00وہ
07:00shoes
07:00کے
07:01equal
07:01ہو گئی
07:01ہے
07:01اور
07:01یہاں
07:02پہ
07:02دیکھئے
07:08یہ
07:09تو
07:09بڑے
07:09کام
07:09کے
07:10functions
07:10ہم
07:11نے
07:11discuss
07:11کی
07:11ہے
07:11ایک
07:12اور
07:12function
07:13ہے
07:13finally
07:13جو
07:14کہ
07:14basically
07:14in case
07:15اگر
07:15آپ کو
07:16shopping
07:16card
07:16empty
07:17کرنا
07:17پڑ
07:18جائے
07:18تو
07:18اس
07:18کے
07:18لئے
07:18آپ
07:19clear
07:19کا
07:19function
07:19جو
07:20ہے
07:20call
07:20کر
07:20سکتے
07:21make
07:21sense
07:22اب
07:22میں
07:22اس
07:23کو
07:23execute
07:23کرتا ہوں
07:24اور
07:24list
07:25آپ
07:25کو
07:25empty
07:26مل
07:26رہی
07:27ہے
07:29اس
07:29میں
07:29کچھ
07:29نہیں
07:29ہے
07:30پوری
07:32list
07:33کو
07:33clear
07:33کر
07:34دیتا
07:34ہے
07:34اور
07:35اس
07:35میں
07:35جتنے
07:35بھی
07:35item
07:36ہوتے
07:36ہیں
07:36وہ
07:36سارے
07:37remove
07:37ہو
07:37جاتے
07:38ہیں
07:38میں
07:38اس
07:38کو
07:38دوبارہ
07:38run
07:38کرتا
07:39ہوں
07:39and
07:39you
07:39see
07:39nothing
07:40because
07:40clear
07:41جو
07:41ہے
07:41ساری
07:42list
07:42کو
07:42clear
07:43کر
07:43دیتا
07:43ہے
07:44good
07:44تو
07:44ہم
07:45نے
07:45آج
07:45کے
07:46اس
07:46lecture
07:46کے
07:46اندر
07:46کتنے
07:47methods
07:47سیکھے
07:48ہم
07:49نے
07:50append
07:50کے
07:50بارے
07:51میں
07:52سیکھا
07:52ہم
07:53نے
07:53dot
07:54extend
07:56کے
07:56بارے
07:56میں
07:56سیکھا
07:57dot
07:57insert
07:59کے
07:59بارے
07:59میں
07:59سیکھا
08:00ٹھیک ہے
08:01اور
08:02اس کے
08:02بعد
08:02کیا سیکھا
08:03ہم
08:03نے
08:03clear
08:03کے
08:03بارے
08:04میں
08:04سیکھا
08:04ٹھیک
08:05ہے
08:05اور
08:07ہم
08:07نے
08:08dot
08:08pop
08:09ٹھیک
08:10ہے
08:10dot
08:11clear
08:12and
08:13list
08:13can
08:13go
08:13on
08:13by
08:14the
08:14way
08:14ٹھیک
08:14ہے
08:14تو
08:15کچھ
08:15There are some famous methods which we will learn today.

Recommended