﻿1
00:00:01,680 --> 00:00:04,080
‫Now let's move on to lists.

2
00:00:05,840 --> 00:00:12,860
‫Lists are very similar to a string, except that each element can be of any type in the strings.

3
00:00:12,890 --> 00:00:19,820
‫Each element was a character, but in lists, each element can be of any type.

4
00:00:20,890 --> 00:00:24,910
‫So to define a list, we have to use square records.

5
00:00:24,940 --> 00:00:29,140
‫So if I write l1l1 is our variable name.

6
00:00:29,410 --> 00:00:32,860
‫Then in a square grid, if I write one, two, three, four.

7
00:00:37,460 --> 00:00:39,980
‫One, two, three, four, five and one.

8
00:00:39,980 --> 00:00:42,590
‫This one is our list.

9
00:00:43,670 --> 00:00:45,500
‫To check right type.

10
00:00:49,210 --> 00:00:49,900
‫And one.

11
00:00:52,490 --> 00:00:56,330
‫It is showing that the type of one character is list.

12
00:00:57,350 --> 00:00:59,180
‫To print all its value.

13
00:00:59,180 --> 00:01:01,130
‫We write print one.

14
00:01:07,390 --> 00:01:10,510
‫And we are getting all the values that one is containing.

15
00:01:13,300 --> 00:01:14,620
‫Just like a strings.

16
00:01:14,620 --> 00:01:19,480
‫We can also use the same slicing techniques to manipulate lists.

17
00:01:19,720 --> 00:01:21,310
‫So if I write.

18
00:01:22,590 --> 00:01:25,200
‫And one square record.

19
00:01:26,880 --> 00:01:27,480
‫Zero.

20
00:01:29,840 --> 00:01:35,270
‫This will give me element present at the zeroth location, which is one.

21
00:01:35,420 --> 00:01:41,660
‫So here one is that location zero two is a location one.

22
00:01:42,050 --> 00:01:43,610
‫Three is the location.

23
00:01:43,610 --> 00:01:46,640
‫Two, four, three and five at four.

24
00:01:47,810 --> 00:01:48,860
‫You just like a string.

25
00:01:48,860 --> 00:01:56,090
‫I can use colon to select multiple elements, so if I write zero, Colon three.

26
00:01:58,280 --> 00:02:01,290
‫It will give me the first three elements here.

27
00:02:01,310 --> 00:02:05,660
‫The location three is excluded, so I will get elements presented.

28
00:02:05,660 --> 00:02:06,800
‫Location zero.

29
00:02:07,010 --> 00:02:13,970
‫Location one and location two three is excluded, just like slicing in the strings.

30
00:02:13,970 --> 00:02:15,950
‫We can also use steps.

31
00:02:16,220 --> 00:02:18,230
‫So if I write 11.

32
00:02:20,190 --> 00:02:24,060
‫Now, if I want to select all the elements, I will just write Colon.

33
00:02:25,440 --> 00:02:27,120
‫Then I will write another colon.

34
00:02:27,780 --> 00:02:32,040
‫So first argument was for the starting location.

35
00:02:32,040 --> 00:02:35,340
‫Second argument was for the stopping location.

36
00:02:35,340 --> 00:02:37,970
‫And the third argument is for the steps.

37
00:02:37,980 --> 00:02:44,790
‫We are not giving a starting and stopping location since we want all the elements and now we are defining

38
00:02:44,790 --> 00:02:45,940
‫a step as two.

39
00:02:45,960 --> 00:02:49,590
‫So it will give me all the alternate elements of my list.

40
00:02:51,630 --> 00:02:57,570
‫So again, it is ignoring two and four since we provided a step of to.

41
00:03:01,650 --> 00:03:05,520
‫It is not necessary for this to have all the elements of same type.

42
00:03:06,540 --> 00:03:10,260
‫You can assign different types of elements in a single list.

43
00:03:10,260 --> 00:03:14,640
‫So if I write, I'll do equal to the square record.

44
00:03:14,790 --> 00:03:16,710
‫One comma.

45
00:03:17,630 --> 00:03:21,440
‫If I want to write a string, I will write a double quotation.

46
00:03:21,740 --> 00:03:22,250
‫A.

47
00:03:24,280 --> 00:03:24,720
‫Coma.

48
00:03:24,730 --> 00:03:28,840
‫If I want to provide floating point numbers, I will write 1.0.

49
00:03:30,740 --> 00:03:31,880
‫And if I run this.

50
00:03:34,100 --> 00:03:40,150
‫My two is created and the data type of my first element is and second element is a string.

51
00:03:40,160 --> 00:03:42,590
‫And the third element is load.

52
00:03:43,730 --> 00:03:47,750
‫But we can assign all this in a single list as well.

53
00:03:51,610 --> 00:03:55,620
‫So if we want to check, we can check using the type operator.

54
00:03:55,660 --> 00:04:05,280
‫If I type now inside a two, I want the data type of first element, so I will write zero and it is

55
00:04:05,280 --> 00:04:07,810
‫the end because one is our end.

56
00:04:08,930 --> 00:04:10,110
‫If I write type.

57
00:04:12,540 --> 00:04:15,120
‫Redo the square bracket one.

58
00:04:17,370 --> 00:04:23,940
‫Which is a string because our A is in double quotation and we have provided a string as a string we

59
00:04:23,970 --> 00:04:25,080
‫write to.

60
00:04:26,780 --> 00:04:28,130
‫Our two is a list.

61
00:04:28,130 --> 00:04:33,020
‫That's why if we just write a type of L2, it will show us list.

62
00:04:35,490 --> 00:04:39,540
‫We can also provide list as an element of another list.

63
00:04:39,780 --> 00:04:42,690
‫So if we write l three equal to.

64
00:04:45,790 --> 00:04:46,480
‫I do.

65
00:04:48,900 --> 00:04:49,590
‫Coma.

66
00:04:50,640 --> 00:04:51,240
‫One.

67
00:04:53,530 --> 00:04:55,390
‫Coma, 2.0.

68
00:04:58,460 --> 00:05:00,020
‫If we run this command.

69
00:05:00,050 --> 00:05:04,330
‫So we have provided list a little list inside all three.

70
00:05:04,340 --> 00:05:05,960
‫So if we print all three.

71
00:05:09,080 --> 00:05:09,560
‫Here.

72
00:05:09,560 --> 00:05:18,140
‫Our first element is a list, which is L2, and our second element is and third element is flawed.

73
00:05:18,710 --> 00:05:22,910
‫So just to check if we write type of.

74
00:05:25,080 --> 00:05:25,890
‫And three.

75
00:05:27,890 --> 00:05:28,700
‫Common zero.

76
00:05:29,690 --> 00:05:34,190
‫This is showing us as list because we have provided L2 inside of L3.

77
00:05:35,820 --> 00:05:36,420
‫Now.

78
00:05:37,350 --> 00:05:40,710
‫We have mentioned how to select the first element of all three.

79
00:05:40,830 --> 00:05:44,940
‫We can just write all three and in record we can write zero.

80
00:05:45,760 --> 00:05:47,890
‫This will give us the first element.

81
00:05:48,220 --> 00:05:50,530
‫My first element is a list.

82
00:05:50,530 --> 00:05:53,710
‫So how to select first element of that list.

83
00:05:53,890 --> 00:05:56,080
‫We can write all three.

84
00:05:58,880 --> 00:05:59,850
‫And square record.

85
00:05:59,870 --> 00:06:01,400
‫I will first write zero.

86
00:06:02,400 --> 00:06:06,930
‫Right now I am accessing my first element, which is a list.

87
00:06:07,200 --> 00:06:12,750
‫Now, if I want the second element of this list, I will write in a square.

88
00:06:12,750 --> 00:06:13,830
‫Record one.

89
00:06:14,860 --> 00:06:17,140
‫If I run this command, it will give us.

90
00:06:18,040 --> 00:06:18,610
‫Director.

91
00:06:18,610 --> 00:06:25,780
‫A These types of lists are called nested lists because we have lists inside the list.

