• 2 years ago
Data structures in Python are ways of organizing and storing data. Lists are a fundamental data structure in Python used to store an ordered collection of items. Lists are mutable, which means their elements can be changed after the list is created. They are versatile and can hold items of different data types, including numbers, strings, and even other lists. Lists are defined using square brackets [], and elements within them are separated by commas.

Category

📚
Learning
Transcript
00:00In this lecture, we will talk about data structures.
00:04This term you will listen very often, data structure.
00:07People will flip it like this.
00:11Data structure is basically data objects to hold for use.
00:18Data structure.
00:19You will understand it.
00:21Items to hold for use.
00:24Or a fridge.
00:26Items to hold for use.
00:28In this case, data structure is not a container,
00:32which can hold for Python's different objects.
00:38Very simple.
00:40Imagine, your camera has a different compartments.
00:46Some are different compartments.
00:48Some are different compartments.
00:50Some are different items.
00:52Some are different items.
00:54These are different items.
00:56Items to be a container.
00:58Items to be a data structure.
01:00Items to be an object.
01:02Items to be an object.
01:04Remember, everything is an object.
01:06And object.
01:07And when we study OOP,
01:09Object Oriented Programming,
01:10Items to be clear.
01:12Items to be clear.
01:14Items to be clear.
01:16Items to be clear.
01:18At the moment,
01:19we use this word to face value.
01:21We use this word.
01:22So,
01:23In the data structure,
01:24the first thing we learn about lists.
01:27I define the list.
01:29I define the list.
01:31Let's say,
01:32list underscore one.
01:33We have a list.
01:34And the list to define the list.
01:36We use square brackets.
01:38As you can see,
01:40we use string to represent the list.
01:42Single quotes.
01:43Or double quotes.
01:44Or triple quotes.
01:46Or triple quotes.
01:48However,
01:49list to represent the list.
01:51We use square brackets.
01:53Use square brackets.
01:54Now,
01:56list is a data structure.
01:59Now,
02:00if I go back to basic definition,
02:03which I have told you,
02:05it's different types.
02:06And the ordered sequence.
02:08The ordered sequence.
02:09The ordered sequence.
02:11The order sequence.
02:12The rule of thumb.
02:14You have to understand.
02:15Yes.
02:16The indexing is possible.
02:18The indexing is possible.
02:19The indexing is possible.
02:20I can access them.
02:22I can access the indexing.
02:23The indexing is possible.
02:24Let's go back to the indexing.
02:25I can get a 36 investment due to a particular question.
02:26I can get a difference between the indexing.
02:27I can see.
02:28I know I'm using indexing.
02:29I can get some time it's important.
02:30But then,
02:31I remove that.
02:32It's very important to get this concept.
02:33Now,
02:34it's very important to get this concept.
02:35Now look.
02:36It's very important to get this concept.
02:37I've seen,
02:38I have an item for this.
02:39How do I do this ?
02:41Here is what I do.
02:42Now,
02:43I can use a list.
02:44Now,
02:45let's imagine.
02:46I can see.
02:47Let's imagine.
02:48नहीं रखा, लिस्ट वन और लिस्ट टू रखा, उसकी रीजन मैं आपको समझाता हूँ, अगर आपको याद हो, मैंने का था कि
02:55बिग नो नोज हैं फोर वैरियबल नेमिंग में, और वो नेमिंग में बिग नो नोज क्या है, आपने वैरियबल को कोई ऐसा नाम
03:03नहीं रखना है, जो कि already python के अंदर exist करता हो, अब जरा देखिए, यहाँ पर list क्या, blue हो रहा है, इसका मतलब यह है, कि blue already python recognize करता है, in its own, जो set of libraries है, कि उसमें list already defined है, तो अगर मैं list यहाँ पर नाम रखती हूँ, तो वो list replace हो जाएगा, वो functionality lose हो जाएगी, तो that is a big no-no, इसलि
03:33comma b, comma c, make sense, good, चलिए, third list एक declare करते है, list 3, अब interesting enough, आपने गोर करना है, कि list जो है, हर किसम का data type को hold कर सकती है, यह देखिए, मैं यहाँ पर इसको कह रहा हूँ, boolean hold है यह, true and false, ठीक है, false के spelling अलत रिख्या है, false, आपने मेरे spelling में से कीड़े नहीं निकालने है, ठीक है,
04:01और क्या पढ़ा हमने, boolean पढ़ा हमने, ठीक है, और हमने पढ़ा कि floating value लिए, देखिए, मैंने floating value define करते है, make sense, अच्छा, अब मैं इनको simple print करा सकता हूँ, अगर मैंने इनकी value देखनी हूँ, कि वाकी यह काम करती भी है नहीं, कि यह देखिए, मैं कहता हूँ, यहाँ यह
04:31all three lists available, अब interesting enough, कि एक list basically जैसा कि मैंने कहा data structure है, तो इसका मतलब यह है, कि list जो है, सिर्फ एक data type को नहीं, बलके हर किसम के data type को hold कर सकती है, मिसाल के तोर पर यह देखिए, मैं एक list for define करने लगाँ, मैं कहता हूँ, list for, और list for की खासियत यह है, कि वो basically, sorry, वो, यह देखिए,
05:01एक string को hold कर रही है, और एक boolean को hold कर रही है, excellent, ठीक है, तो यह data structure की खासियत है, कि वो हर type of data को hold कर सकती है, अब अगर very basic definition पर चले जाएं, तो मैंने कहा था, कि list जो है, ordered sequence of object है, जैसा कि string ordered sequence of character था, जिसमें character आते थे, 0, 1, 2, 3, 3 पे,
05:28list के अंदर basically objects आते हैं, अब जरा देखिए, मैं इसका पहला element access करने लगा हूँ, मैं कहता हूँ, zero access करो, और इसका दूसरा element access करने लगे हैं, मैं कहता हूँ, one access करो, मैं इसको execute करता हूँ, अब आपने जरा गोर करना है, कि पहला element one, इसका दूसरा element b, यहां पर print हुआ हु�
05:58list کے اندر ایک اور list کو hold
06:00کر آ سکتا ہوں
06:00Isn't it very cool? یہ دیکھئے
06:03میں ایک list بناتا ہوں
06:04اور یہ دیکھئے
06:06اس list کے خاصیت یہ ہے
06:08کہ اس list نے دو اور list
06:10hold کی ہوئی ہیں
06:11اب اگر میں اس کی indexing کرتا ہوں
06:14تو میں basically اس پورے object
06:16کو access کروں گا
06:17یہ دیکھئے یہ ہے zero
06:18میں اس کو remove کر دیتا ہوں
06:19three کی اب ہمیں ضرورت نہیں ہے
06:20یہاں پر بھی three کی ہمیں ضرورت نہیں ہے
06:22اور one کی بھی ضرورت نہیں ہے
06:23اب ذرا غور کرنا آپ نے
06:26یہ ہے zero, one, two and three
06:30اگر میں یہاں پر کہتا ہوں
06:31three
06:32تو آپ نے ایک چیز نوڈ کرنی ہے
06:34کہ بجائے ہمیں
06:35ایک element ملنے کے
06:37اس three index کے اوپر
06:39ایک پوری list پڑی ہوئی ہے
06:40جو کہ ہمیں return ہوگی
06:41Isn't it very cool?
06:43one, two, three, point five
06:44اچھا اب ذرا آپ نے غور کرنا
06:46اگر میں نے اس list کے اندر
06:48کسی element کو access کرنا ہو
06:49تب کیا ہوگا
06:50تو basically
06:51یہ جو پوری کی پوری value
06:53نظر آ رہی ہے آپ کو
06:54list two اور اس کا index three
06:56یہ in itself ایک list ہے
06:58تو ایک list کی
06:59again indexing کو
07:01کسی element کو
07:03یا object کو
07:03access کرنے کے لیے
07:04again مجھے indexing کرنی پڑے گی
07:06اور let's say
07:06میں two کو access کرنا چاہتا ہوں
07:08تو two جو ہے وہ
07:09first position
07:10یعنی کہ
07:10one position پر پڑا ہوا ہے
07:11اور جو ہی run کرتا ہوں
07:12مجھے two return ہو جاتا ہے
07:14Isn't it cool?
07:15It's very cool
07:15اس کی reason یہ ہے
07:16کہ آپ list کو
07:18اپنی آنے والے
07:20جو ابھی جو course ہے
07:21جس میں ہم data science کے بارے میں
07:22seeking
07:23you will see arrays
07:24جس میں آپ multi dimensional lists
07:26کے بارے میں پڑیں گے
07:27اور ابھی آپ نے پریشان نہیں ہونا
07:28کہ یہ array کیا چیز اب آگئی ہے
07:30آپ نے بس اس کو
07:31یہیں پہ
07:31break لگا دینی
07:33اچھا list ہے
07:34different object کو hold کرتی ہے
07:35اب جانے سے پہلے
07:38ایک آخری چیز
07:39یہاں پہ میں
07:40discuss کرنا چاہتا ہوں
07:41وہ یہ کہ
07:42آپ نے ذرا غور کرنا ہے
07:45اب تھوڑا سا
07:45اگر اب میں اس کو کہتا ہوں
07:47کہ اس کا
07:48first index access کرو
07:50تو آپ کے خیال سے
07:51کیا result ہوگا
07:52یہ پورے کا پورا
07:54ایک single element ہے
07:57two
07:58ٹھیک ہے
07:59اب اس single element کی
08:01index one کے اوپر
08:02کوئی چیز پڑی ہوئی ہے
08:03کوئی بھی چیز نہیں پڑی ہوئی
08:04اگر میں اس کو
08:05execute کرتا ہوں
08:06تو یہ مجھے
08:07error دے گا
08:07کہے گا
08:08یہ
08:08basically accessible
08:10نہیں ہے
08:10تو یہ
08:11مجھے
08:11error دے گا
08:12کہے گا
08:12یہ
08:13basically
08:13accessible
08:14نہیں ہے
08:15تو یہ جو
08:15code آپ لکھ رہے ہیں
08:16that is not
08:17correct
08:17ٹھیک ہوگی
08:18بات

Recommended