Skip to player
Skip to main content
Skip to footer
Search
Connect
Watch fullscreen
Like
Comments
Bookmark
Share
Add to Playlist
Report
Lecture 41: List Programatically in Python
Nafees AI Lab
Follow
5/17/2025
append(): Syntax: list_name.append(element) ...
copy(): Syntax: list_name.copy() ...
clear(): Syntax: list_name.clear() ...
count(): Syntax: list_name.count(element) ...
extend(): Syntax: list_name.extend(iterable) ...
index(): Syntax: list_name.index(element) ...
insert(): ...
pop():
Category
π
Learning
Transcript
Display full video transcript
00:00
Hello and welcome back guys.
00:05
In this lecture, I am going to teach you how we can create lists automatically.
00:11
Now you have seen that when the list is created,
00:14
I wrote some names and said numbers is equal to
00:19
and then 1, 2, 3, 4, 5, 6, 7.
00:23
This is quite boring.
00:25
The second issue is that the list is not 1-9.
00:31
We all know that in real world, there are no green garden and rainbows.
00:35
In real world, there are no edgy projects.
00:39
The list is not so large.
00:42
There is no method to generate lists automatically.
00:51
Yes, there is a method.
00:54
There is a function.
00:56
There is a function.
00:58
It is called range.
01:00
Range basically, our list is automatically created.
01:04
Now, if I say range,
01:08
Range is the feature of start point and end point.
01:12
For example, I want to create 1-10.
01:16
1, 10.
01:18
If I print it, you will see nothing.
01:22
You will see an iterator.
01:24
You will see range 1-10.
01:26
Range 1-10.
01:28
Range 1-10.
01:30
However, if I convert it in list,
01:34
So, as you remember,
01:36
We have started with int-math type conversion.
01:40
Str type conversion.
01:42
Integer, string, string, integer.
01:44
This is a list.
01:46
Basically, if you give an iterator,
01:48
you will convert it.
01:50
So, I put the list here.
01:52
I put the range here.
01:54
I will wrap this range.
01:56
I will wrap this range.
01:58
I will run this.
02:00
Let's see what happens.
02:02
Balance is not a problem.
02:04
Balance is not a problem.
02:06
Now, we run this.
02:08
And Kaboom, Shaka, Laka,
02:10
1-10.
02:12
Now, interesting enough,
02:14
You can create 1-100.
02:16
It's totally up to you.
02:17
And actually, you can create 1-2000.
02:19
It's not a problem.
02:21
And this is one of the main reasons
02:24
You will have to work with very big lists.
02:29
You can create them just like that.
02:33
Before closing this lecture,
02:35
I will tell you a big trick.
02:38
I will tell you that
02:40
when we were the variable assignment
02:41
we were able to assign two variables
02:43
in one statement.
02:45
We can assign two variables.
02:46
We can assign two variables.
02:47
I will say a comma b is equal to 1 comma 2.
02:49
And in this case,
02:50
if I print it.
02:52
Print.
02:53
Print.
02:54
Print.
02:55
Print.
02:56
Print.
02:57
Print.
02:58
Print.
02:59
Print.
03:00
Print.
03:01
Print.
03:02
Print.
03:03
Print.
03:04
Print.
03:05
Print.
03:06
Print.
03:07
Print.
03:08
Print.
03:09
Print.
03:10
Print.
03:11
Print.
03:12
Print.
03:13
Print.
03:14
Print.
03:15
Print.
03:16
Print.
03:17
Print.
03:18
Print.
03:19
Print.
03:20
Print.
03:21
Print.
03:22
Print.
03:23
Print.
03:24
Print.
03:25
Print.
03:26
Print.
03:27
Print.
03:28
Print.
03:29
Print.
03:30
Print.
03:31
Print.
03:32
Print.
03:33
Print.
03:34
There is such a way that I say,
03:36
okay, first two values,
03:38
and the other ones are separate.
03:40
Then,
03:42
we put a comma and a hysteric.
03:46
Then, I say, remaining.
03:48
Okay, remaining list.
03:52
Make sense?
03:54
I will execute this.
03:56
I will give you two values.
03:58
The other one will give you two values.
04:00
The remaining list is the variable.
04:02
Now, as you see, one, two, three, and remaining list.
04:12
It's cool.
04:14
It's very, very cool.
04:16
It's very, very cool.
04:18
Now, range.
04:20
You can unpack list in the way you want.
04:24
You can unpack list in the way you want.
04:28
Now, for example,
04:30
the star remaining will go to the end.
04:34
The first one will go to the end.
04:36
But if you have a value assign,
04:40
the final value will go to the end.
04:42
The second one will be assigned.
04:44
For example, I will say,
04:46
ABCD.
04:48
Then, the seven will assign.
04:50
And the six will be available.
04:52
I'll print it.
04:54
In print, we say,
04:56
and we run it, and we run it, and kaboom, shaka, laaka.
Recommended
8:31
|
Up next
Farhan Ali Waris _ Abbas Ko Bulao _ 2021 _ 1443
Gham-e-Hussain | ΨΊΩ Ω ΨΨ³ΫΩΨ
6/9/2025
9:38
Episode 1 β The Curious Boy from Ulm (1879-1895)
Nafees AI Lab
6/8/2025
0:37
Top Fully Funded Scholarships in Germany 2025 π©πͺ | Apply Now!
Nafees AI Lab
6/3/2025
0:25
The Boy and the Dragon β βA Friend in the Skyβ
Nafees AI Lab
6/3/2025
1:03
Why Do Rainbows Appear? π | Physics in Everyday Life
Nafees AI Lab
6/3/2025
0:28
Albert Einstein: The Genius Who Changed Time
Nafees AI Lab
6/1/2025
0:40
Stephen Hawkingβs Life in 60 Seconds: From Wheelchair to the Universe
Nafees AI Lab
6/1/2025
0:36
The Forgotten Night Hitler Was Nearly Killed
Nafees AI Lab
5/29/2025
0:31
Dilip Kumar β The Tragedy King of Bollywood
Nafees AI Lab
5/29/2025
0:45
Marlon Brando β The Rebel Who Redefined Acting | Nafees AI Lab
Nafees AI Lab
5/29/2025
0:29
Charles Darwin β Evolution & Natural Selection | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:30
Isaac Newton β Gravity, Motion & Genius | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:52
Allama Iqbal β Poet of the East | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:53
Marie Curie β Life & Achievements | Nafees AI Lab
Nafees AI Lab
5/28/2025
0:42
Albert Einstein β Life, Legacy & Discoveries | Nafees AI Lab
Nafees AI Lab
5/28/2025
10:08
Pandas Class 10: Manipulating Data β Sorting, Renaming & More
Nafees AI Lab
5/28/2025
12:30
Pandas Class 09: Adding & Removing Data in Pandas
Nafees AI Lab
5/28/2025
11:25
Pandas Class 08: Changing Data in Pandas β Replace & Update
Nafees AI Lab
5/28/2025
14:15
Pandas Class 07: More on Data Selection in Pandas
Nafees AI Lab
5/28/2025
13:58
Pandas Class 06: Data Selection in Pandas β iloc & loc
Nafees AI Lab
5/28/2025
6:59
Pandas Class 05: Describing & Summarizing Data in Pandas
Nafees AI Lab
5/26/2025
7:00
Pandas Class 04 β How to Import CSV, Excel & JSON Files
Nafees AI Lab
5/26/2025
10:09
Pandas Class 03 β Understanding DataFrames in Pandas
Nafees AI Lab
5/26/2025
3:06
Pandas Class 02 β What is Pandas & Course Overview
Nafees AI Lab
5/26/2025
5:36
Pandas Class 01 β Tools Needed to Start Data Analysis
Nafees AI Lab
5/26/2025