Difference between revisions of "Python/C3/Getting-started-with-arrays/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello friends and welcome to the spoken tutorial on 'Getting started with arrays'. |- | 0:06 | At the end of this tutorial, you wi…')
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{| border=1
 
{| border=1
!Visual Cue
+
|'''Time'''
!Narration
+
|'''Narration'''
 +
 
 
|-
 
|-
| 0:01
+
| 00:01
 
| Hello friends and welcome to the spoken tutorial on 'Getting started with arrays'.
 
| Hello friends and welcome to the spoken tutorial on 'Getting started with arrays'.
  
 
|-
 
|-
| 0:06
+
| 00:06
 
| At the end of this tutorial, you will be able to,
 
| At the end of this tutorial, you will be able to,
 
+
Create arrays using data.
# Create arrays using data.
+
Create arrays from lists.
# Create arrays from lists.
+
Perform basic array operations.
# Perform basic array operations.
+
Create identity matrix.
# Create identity matrix.
+
Use functions zeros(), zeros underscore like(), ones(), ones underscore like().
# Use functions zeros(), zeros underscore like(), ones(), ones underscore like().
+
  
 
|-
 
|-
| 0:26
+
| 00:26
 
| So Before beginning this tutorial,we would suggest you to complete the tutorial on "Getting started with Lists".
 
| So Before beginning this tutorial,we would suggest you to complete the tutorial on "Getting started with Lists".
  
 
|-
 
|-
| 0:35
+
| 00:35
 
| Arrays are homogeneous data structures.
 
| Arrays are homogeneous data structures.
 
   
 
   
 
|-
 
|-
| 0:39
+
| 00:39
 
|Unlike lists, arrays cannot have heterogeneous data elements.  
 
|Unlike lists, arrays cannot have heterogeneous data elements.  
  
 
|-
 
|-
| 0:45
+
| 00:45
 
|They can have only one type of data as their entries, be them all integers, strings, or maybe floats, but not a mix.
 
|They can have only one type of data as their entries, be them all integers, strings, or maybe floats, but not a mix.
  
 
|-
 
|-
| 0:55
+
| 00:55
 
|Arrays of a given length are comparatively much faster in mathematical operations than lists of the same length, because of the fact that they are homogeneous data structures.
 
|Arrays of a given length are comparatively much faster in mathematical operations than lists of the same length, because of the fact that they are homogeneous data structures.
  
 
|-
 
|-
| 1:07
+
|01:07
 
|Let us see how to create arrays.
 
|Let us see how to create arrays.
  
 
|-
 
|-
| 1:11
+
| 01:11
| Run your IPython interpreter with <tt>space hypen pylab</tt> option, to load the required modules to work with arrays.
+
| Run your IPython interpreter with space hypen pylab option, to load the required modules to work with arrays.
  
 
|-
 
|-
|1:21
+
|01:21
|So type ipyhton space hypen pylab
+
|So type ipython space hypen pylab
  
 
|-
 
|-
| 1:28
+
| 01:28
| To create an array we will use the function <tt>array()</tt> as,a1 = array within brackets square brackets 1 comma 2 comma 3 comma 4   
+
| To create an array we will use the function array() as,a1 = array within brackets square brackets 1 comma 2 comma 3 comma 4   
  
 
|-
 
|-
| 1:45
+
| 01:45
 
| Notice that we created a one dimensional array here.
 
| Notice that we created a one dimensional array here.
  
 
|-
 
|-
| 1:49
+
| 01:49
 
| Also notice that the object we passed to create an array is a list.
 
| Also notice that the object we passed to create an array is a list.
  
 
|-
 
|-
| 1:54
+
| 01:54
 
|Now let us see how to create a two dimensional array.
 
|Now let us see how to create a two dimensional array.
  
 
|-
 
|-
| 1:58
+
| 01:58
 
|We create two dimensional array by converting a list of lists to an array as,
 
|We create two dimensional array by converting a list of lists to an array as,
 
a2 = array within brackets within square brackets 1 comma 2 comma 3 comma 4  comma then again within square brackets 5 comma 6 comma 7 comma 8 and hit enter.
 
a2 = array within brackets within square brackets 1 comma 2 comma 3 comma 4  comma then again within square brackets 5 comma 6 comma 7 comma 8 and hit enter.
  
 
|-
 
|-
| 2:38
+
| 02:38
| Now let us use <tt>arange()</tt> function to create the same array as before.
+
| Now let us use arrange() function to create the same array as before.
  
 
|-
 
|-
|2:45
+
|02:45
|For that type ar = arange within bracket 1 comma 9 and hit enter,so type  
+
|For that type ar = arrange within bracket 1 comma 9 and hit enter,so type  
 
print ar to get the output.
 
print ar to get the output.
  
 
|-
 
|-
3:02
+
03:02
 
| So now, As you can see, we obtained a one dimensional array with elements from 1 to 8.
 
| So now, As you can see, we obtained a one dimensional array with elements from 1 to 8.
  
 
|-
 
|-
| 3:12
+
| 03:12
 
|Now can we make it a two dimensional array of order 2 by 4? Yes,we can.
 
|Now can we make it a two dimensional array of order 2 by 4? Yes,we can.
  
 
|-
 
|-
| 3:20
+
| 03:20
|For this we will have to use the function <tt>reshape()</tt>,
+
|For this we will have to use the function reshape() ,
  
 
|-
 
|-
|3:24
+
|03:24
 
|So type ar.reshape brackets  2 comma 4 and hit enter
 
|So type ar.reshape brackets  2 comma 4 and hit enter
  
 
|-
 
|-
|3:33
+
|03:33
|So type ar.reshape within brackets 4 comma 2
+
|So type ar.reshape within brackets 4 comma 2 then  ar = ar dot reshape within brackets 2,4  
then  ar = ar dot reshape within brackets 2,4  
+
  
 
|-
 
|-
| 3:55
+
| 03:55
 
| Hence,we got our two-dimensional array.
 
| Hence,we got our two-dimensional array.
  
 
|-
 
|-
| 3:58
+
| 03:58
 
|Now, let us see how to convert a list object to an array.  
 
|Now, let us see how to convert a list object to an array.  
  
 
|-
 
|-
| 4:02
+
| 04:02
 
|We define a list,say l1
 
|We define a list,say l1
  
 
|-
 
|-
|4:07
+
|04:07
 
|So type l1 = within square brackets 1 comma 2 comma 3 comma 4 and hit enter
 
|So type l1 = within square brackets 1 comma 2 comma 3 comma 4 and hit enter
  
 
|-
 
|-
| 4:16
+
| 04:16
 
| Now to convert this list to an array,we use the array function as, a3 = array within brackets l1  
 
| Now to convert this list to an array,we use the array function as, a3 = array within brackets l1  
  
 
|-
 
|-
4:30
+
04:30
| To find the shape of an array we can use the method <tt>dot shape</tt>,  
+
| To find the shape of an array we can use the method dot shape ,  
  
 
|-
 
|-
| 4:36
+
| 04:36
 
|let us check the shape of the arrays we have created so far,
 
|let us check the shape of the arrays we have created so far,
  
 
|-
 
|-
| 4:44
+
| 04:44
| <tt>a2 dot shape</tt> object is a tuple, and it returned a tuple (2 comma 4).
+
| a2 dot shape object is a tuple, and it returned a tuple (2 comma 4).
  
 
|-
 
|-
| 4:52
+
| 04:52
 
|A tuple is nothing but an ordered list of elements.
 
|A tuple is nothing but an ordered list of elements.
  
 
|-
 
|-
| 4:56
+
| 04:56
 
|So Pause the video here, try out the following exercise and resume the video.
 
|So Pause the video here, try out the following exercise and resume the video.
  
 
|-
 
|-
| 5:12
+
| 05:12
 
| Find out the shape of the other arrays i.e. a1 comma a3 comma ar that we have created.
 
| Find out the shape of the other arrays i.e. a1 comma a3 comma ar that we have created.
  
 
|-
 
|-
|5:22
+
|05:22
 
|It can be done as
 
|It can be done as
 
a1 dot shape
 
a1 dot shape
Line 151: Line 150:
  
 
|-
 
|-
5:37
+
05:37
 
| Now let us try to create a new array with a mix of elements and see what will happen,
 
| Now let us try to create a new array with a mix of elements and see what will happen,
  
 
|-
 
|-
|5:45
+
|05:45
 
|So type a4 = array within brackets then square bracket 1 comma 2 comma 3 comma and single quote a string and hit enter
 
|So type a4 = array within brackets then square bracket 1 comma 2 comma 3 comma and single quote a string and hit enter
  
 
|-
 
|-
6:07
+
06:07
| Well, we would expect an error as it has been previously mentioned that arrays handle elements with the same datatype, but it didn't raise an error.  
+
| Well, we would expect an error as it has been previously mentioned that arrays handle elements with the same data type, but it didn't raise an error.  
  
 
|-
 
|-
| 6:16
+
| 06:16
 
|Let us check the values in the new array created.  
 
|Let us check the values in the new array created.  
  
 
|-
 
|-
| 6:19
+
| 06:19
 
|So Type a4 in the terminal,
 
|So Type a4 in the terminal,
  
 
|-
 
|-
| 6:27
+
| 06:27
 
| Did you notice it, all the elements have been implicitly type casted as strings, though our first three elements were meant to be integers.
 
| Did you notice it, all the elements have been implicitly type casted as strings, though our first three elements were meant to be integers.
  
 
|-
 
|-
| 6:37
+
|06:37
 
| Also,if you have noticed,we got something like 'dtype S8' in the output.
 
| Also,if you have noticed,we got something like 'dtype S8' in the output.
  
 
|-
 
|-
| 6:44
+
| 06:44
| dtype is nothing but the datatype which is the minimum type required to hold the objects in the sequence.
+
| dtype is nothing but the data type which is the minimum type required to hold the objects in the sequence.
  
 
|-
 
|-
| 6:52
+
| 06:52
 
| Let us now move on to study functions like zeros() function and ones() function.  
 
| Let us now move on to study functions like zeros() function and ones() function.  
  
 
|-
 
|-
|6:59
+
|06:59
 
|For this ,we will have to create a matrix.  
 
|For this ,we will have to create a matrix.  
  
 
|-
 
|-
|7:02
+
|07:02
 
|let us see how to create an identity matrix of a given size, this is a two-dimensional array in which all the diagonal elements are ones and rest of the elements are zeros.  
 
|let us see how to create an identity matrix of a given size, this is a two-dimensional array in which all the diagonal elements are ones and rest of the elements are zeros.  
  
 
|-
 
|-
| 7:13
+
| 07:13
|We can create an identity matrix using the function <tt>identity()</tt>.
+
|We can create an identity matrix using the function identity() .
  
 
|-
 
|-
| 7:18
+
| 07:18
|The function <tt>identity()</tt> takes an integer argument which specifies the size of the desired matrix,
+
|The function identity()   takes an integer argument which specifies the size of the desired matrix,
  
 
|-
 
|-
| 7:27
+
| 07:27
 
| As you can see the identity function returned a three by three square matrix with all the diagonal elements as one and the rest of the elements as zeros.
 
| As you can see the identity function returned a three by three square matrix with all the diagonal elements as one and the rest of the elements as zeros.
  
 
|-
 
|-
|7:43
+
|07:43
 
|So type identity within brackets 3
 
|So type identity within brackets 3
  
 
|-
 
|-
| 7:48
+
| 07:48
|<tt>zeros()</tt> function accepts a tuple, which is the order of the array that we want to create, and it generates an array with all elements as zeros.
+
| zeros() function accepts a tuple, which is the order of the array that we want to create, and it generates an array with all elements as zeros.
  
 
|-
 
|-
| 7:59
+
| 07:59
 
|Let us create an array of the order four by five with all the elements zero.
 
|Let us create an array of the order four by five with all the elements zero.
  
 
|-
 
|-
|8:06
+
|08:06
 
| We can do it using the method zeros(),
 
| We can do it using the method zeros(),
  
 
|-
 
|-
|8:10
+
|08:10
 
|So type zeros within brackets then again in bracket 4 comma 5 and hit enter
 
|So type zeros within brackets then again in bracket 4 comma 5 and hit enter
  
 
|-
 
|-
| 8:21
+
| 08:21
 
| Notice that we passed a tuple to the function zeros.  
 
| Notice that we passed a tuple to the function zeros.  
  
 
|-
 
|-
| 8:25
+
| 08:25
 
|Pause the video here, try out the following exercise and resume the video.
 
|Pause the video here, try out the following exercise and resume the video.
  
 
|-
 
|-
|8:33
+
|08:33
 
|So now we learnt two functions identity and zeros
 
|So now we learnt two functions identity and zeros
  
 
|-
 
|-
8:38
+
08:38
 
| '''Find out about the functions'''
 
| '''Find out about the functions'''
  
 
|-
 
|-
| 8:41
+
| 08:41
 
| zeros underscore like()
 
| zeros underscore like()
  
 
|-
 
|-
| 8:43
+
| 08:43
| ones()
+
| ones(), ones underscore like()
  
 
|-
 
|-
| 8:44
+
| 08:48
| ones underscore like()
+
 
+
|-
+
| 8:48
+
 
| Try the following, first check the value of a1,
 
| Try the following, first check the value of a1,
  
 
|-
 
|-
| 8:52
+
| 08:52
| We see that <tt>a1</tt> is a single dimensional array,
+
| We see that a1 is a single dimensional array,
  
 
|-
 
|-
|8:56
+
|08:56
 
|So type a1 and hit enter
 
|So type a1 and hit enter
  
 
|-
 
|-
| 9:01
+
| 09:01
 
| So next  now try a1 into 2
 
| So next  now try a1 into 2
  
 
|-
 
|-
|9:05
+
|09:05
 
|So type a1 into 2
 
|So type a1 into 2
  
 
|-
 
|-
| 9:09
+
| 09:09
 
| It returned a new array with all the elements multiplied by 2.  
 
| It returned a new array with all the elements multiplied by 2.  
  
 
|-
 
|-
| 9:13
+
| 09:13
 
|Now let us again check the contents of a1
 
|Now let us again check the contents of a1
  
 
|-
 
|-
| 9:19
+
| 09:19
 
| note that the value of a1 still remains the same.
 
| note that the value of a1 still remains the same.
  
 
|-
 
|-
|9:23
+
|09:23
 
|Similarly with addition,so type a1 plus 2 and hit enter and then type a1
 
|Similarly with addition,so type a1 plus 2 and hit enter and then type a1
  
 
|-
 
|-
|9:36
+
|09:36
 
| it returns a new array, with all the elements summed with two.  
 
| it returns a new array, with all the elements summed with two.  
  
 
|-
 
|-
|9:41
+
|09:41
 
|But again notice that the value of a1 has not been changed.
 
|But again notice that the value of a1 has not been changed.
  
 
|-
 
|-
|9:46
+
|09:46
 
|You may change the value of a1 by simply assigning the newly returned array as,a1 space plus=2
 
|You may change the value of a1 by simply assigning the newly returned array as,a1 space plus=2
  
Line 316: Line 311:
 
|-
 
|-
 
| 10:22
 
| 10:22
| Now let us try this a1 = array within brackets square brackets 1 comma 2 comma 3 comma 4
+
| Now let us try this a1 = arrays within brackets square brackets 1 comma 2 comma 3 comma 4
 
and hit enter
 
and hit enter
  
 
|-
 
|-
 
|10:45
 
|10:45
|then a2 = array within brackets square brackets 1 comma 2 comma 3 comma 4
+
|then a2 = array within brackets square brackets 1 comma 2 comma 3 comma 4 then type a1 + a2 and hit enter
then type a1 + a2
+
and hit enter
+
  
 
|-
 
|-
Line 347: Line 340:
 
|-
 
|-
 
| 11:41
 
| 11:41
|In this tutorial, we have learnt to,
+
|In this tutorial, we have learnt to, Create an array using the array() function.
1. Create an array using the <tt>array()</tt> function.
+
  
 
|-
 
|-
 
| 11:46
 
| 11:46
| 2. Convert a list to an array.
+
|Convert a list to an array.
  
 
|-
 
|-
 
| 11:49
 
| 11:49
| 3. Perform some basic operations on arrays like addition,multiplication.
+
| Perform some basic operations on arrays like addition,multiplication.
  
 
|-
 
|-
 
| 11:53
 
| 11:53
| 4. Use functions like - .shape - arrange() - .reshape - zeros() & zeros underscore like() - ones() & ones underscore like()
+
| Use functions like - .shape - arrange() - .reshape - zeros() & zeros underscore like() - ones() & ones underscore like()
  
 
|-
 
|-
Line 368: Line 360:
 
|-
 
|-
 
| 12:09
 
| 12:09
|1.First one, <tt><nowiki>x = array within brackets square bracket 1 comma 2 comma 3 comma square bracket 5 comma 6 comma 7</nowiki></tt> is a valid statement
+
|First one, x = array within brackets square bracket 1 comma 2 comma 3 comma square bracket 5 comma 6 comma 7 is a valid statement
  
 
|-
 
|-
Line 376: Line 368:
 
|-
 
|-
 
| 12:27
 
| 12:27
| 2. What does the <tt>ones underscore like()</tt> function do?
+
| What does the ones underscore like() function do?
  
 
|-
 
|-
 
| 12:31
 
| 12:31
| A. Returns an array of ones with the same shape and type as a given array.
+
| Returns an array of ones with the same shape and type as a given array.
  
 
|-
 
|-
 
| 12:37
 
| 12:37
|B. Return a new array of given shape and type, filled with ones.
+
|Return a new array of given shape and type, filled with ones.
  
 
|-
 
|-
Line 408: Line 400:
 
|-
 
|-
 
| 12:56
 
| 12:56
| So And the answers,
+
| So let's find the answers,
  
 
|-
 
|-
 
| 12:59
 
| 12:59
|1. The answer is False.
+
| The answer is False.
  
 
|-
 
|-
Line 420: Line 412:
 
|-
 
|-
 
|13:10
 
|13:10
|Type <nowiki>x = array within brackets square brackets 1 comma 2 comma 3 comma square brackets 5 comma 6 comma 7</nowiki>
+
|Type x = array within brackets square brackets 1 comma 2 comma 3 comma within brackets 5 comma 6 comma 7
  
 
|-
 
|-
 
|13:21
 
|13:21
| 1. The function <tt>ones underscores like()</tt> returns an array of ones with the same shape and type as a given array.
+
| The function ones underscores like() returns an array of ones with the same shape and type as a given array.
  
 
|-
 
|-

Latest revision as of 11:51, 27 March 2017

Time Narration
00:01 Hello friends and welcome to the spoken tutorial on 'Getting started with arrays'.
00:06 At the end of this tutorial, you will be able to,

Create arrays using data. Create arrays from lists. Perform basic array operations. Create identity matrix. Use functions zeros(), zeros underscore like(), ones(), ones underscore like().

00:26 So Before beginning this tutorial,we would suggest you to complete the tutorial on "Getting started with Lists".
00:35 Arrays are homogeneous data structures.
00:39 Unlike lists, arrays cannot have heterogeneous data elements.
00:45 They can have only one type of data as their entries, be them all integers, strings, or maybe floats, but not a mix.
00:55 Arrays of a given length are comparatively much faster in mathematical operations than lists of the same length, because of the fact that they are homogeneous data structures.
01:07 Let us see how to create arrays.
01:11 Run your IPython interpreter with space hypen pylab option, to load the required modules to work with arrays.
01:21 So type ipython space hypen pylab
01:28 To create an array we will use the function array() as,a1 = array within brackets square brackets 1 comma 2 comma 3 comma 4
01:45 Notice that we created a one dimensional array here.
01:49 Also notice that the object we passed to create an array is a list.
01:54 Now let us see how to create a two dimensional array.
01:58 We create two dimensional array by converting a list of lists to an array as,

a2 = array within brackets within square brackets 1 comma 2 comma 3 comma 4 comma then again within square brackets 5 comma 6 comma 7 comma 8 and hit enter.

02:38 Now let us use arrange() function to create the same array as before.
02:45 For that type ar = arrange within bracket 1 comma 9 and hit enter,so type

print ar to get the output.

03:02 So now, As you can see, we obtained a one dimensional array with elements from 1 to 8.
03:12 Now can we make it a two dimensional array of order 2 by 4? Yes,we can.
03:20 For this we will have to use the function reshape() ,
03:24 So type ar.reshape brackets 2 comma 4 and hit enter
03:33 So type ar.reshape within brackets 4 comma 2 then ar = ar dot reshape within brackets 2,4
03:55 Hence,we got our two-dimensional array.
03:58 Now, let us see how to convert a list object to an array.
04:02 We define a list,say l1
04:07 So type l1 = within square brackets 1 comma 2 comma 3 comma 4 and hit enter
04:16 Now to convert this list to an array,we use the array function as, a3 = array within brackets l1
04:30 To find the shape of an array we can use the method dot shape ,
04:36 let us check the shape of the arrays we have created so far,
04:44 a2 dot shape object is a tuple, and it returned a tuple (2 comma 4).
04:52 A tuple is nothing but an ordered list of elements.
04:56 So Pause the video here, try out the following exercise and resume the video.
05:12 Find out the shape of the other arrays i.e. a1 comma a3 comma ar that we have created.
05:22 It can be done as

a1 dot shape a3 dot shape ar dot shape in the terminal

05:37 Now let us try to create a new array with a mix of elements and see what will happen,
05:45 So type a4 = array within brackets then square bracket 1 comma 2 comma 3 comma and single quote a string and hit enter
06:07 Well, we would expect an error as it has been previously mentioned that arrays handle elements with the same data type, but it didn't raise an error.
06:16 Let us check the values in the new array created.
06:19 So Type a4 in the terminal,
06:27 Did you notice it, all the elements have been implicitly type casted as strings, though our first three elements were meant to be integers.
06:37 Also,if you have noticed,we got something like 'dtype S8' in the output.
06:44 dtype is nothing but the data type which is the minimum type required to hold the objects in the sequence.
06:52 Let us now move on to study functions like zeros() function and ones() function.
06:59 For this ,we will have to create a matrix.
07:02 let us see how to create an identity matrix of a given size, this is a two-dimensional array in which all the diagonal elements are ones and rest of the elements are zeros.
07:13 We can create an identity matrix using the function identity() .
07:18 The function identity() takes an integer argument which specifies the size of the desired matrix,
07:27 As you can see the identity function returned a three by three square matrix with all the diagonal elements as one and the rest of the elements as zeros.
07:43 So type identity within brackets 3
07:48 zeros() function accepts a tuple, which is the order of the array that we want to create, and it generates an array with all elements as zeros.
07:59 Let us create an array of the order four by five with all the elements zero.
08:06 We can do it using the method zeros(),
08:10 So type zeros within brackets then again in bracket 4 comma 5 and hit enter
08:21 Notice that we passed a tuple to the function zeros.
08:25 Pause the video here, try out the following exercise and resume the video.
08:33 So now we learnt two functions identity and zeros
08:38 Find out about the functions
08:41 zeros underscore like()
08:43 ones(), ones underscore like()
08:48 Try the following, first check the value of a1,
08:52 We see that a1 is a single dimensional array,
08:56 So type a1 and hit enter
09:01 So next now try a1 into 2
09:05 So type a1 into 2
09:09 It returned a new array with all the elements multiplied by 2.
09:13 Now let us again check the contents of a1
09:19 note that the value of a1 still remains the same.
09:23 Similarly with addition,so type a1 plus 2 and hit enter and then type a1
09:36 it returns a new array, with all the elements summed with two.
09:41 But again notice that the value of a1 has not been changed.
09:46 You may change the value of a1 by simply assigning the newly returned array as,a1 space plus=2
10:03 Notice the change in elements of a by typing 'a' so type a and hit enter
10:13 so type a1 to get the output
10:18 We can use all the mathematical operations with arrays,
10:22 Now let us try this a1 = arrays within brackets square brackets 1 comma 2 comma 3 comma 4

and hit enter

10:45 then a2 = array within brackets square brackets 1 comma 2 comma 3 comma 4 then type a1 + a2 and hit enter
11:07 This returns an array with element by addition
11:15 So try out a1 into a2
11:23 a1 into a2 returns an array with element by element multiplication,
11:31 And notice that it does not perform matrix multiplication.
11:37 This brings us to the end of the end of this tutorial.
11:41 In this tutorial, we have learnt to, Create an array using the array() function.
11:46 Convert a list to an array.
11:49 Perform some basic operations on arrays like addition,multiplication.
11:53 Use functions like - .shape - arrange() - .reshape - zeros() & zeros underscore like() - ones() & ones underscore like()
12:05 Here are some self assessment questions for you to solve
12:09 First one, x = array within brackets square bracket 1 comma 2 comma 3 comma square bracket 5 comma 6 comma 7 is a valid statement
12:23 So IS True or False?
12:27 What does the ones underscore like() function do?
12:31 Returns an array of ones with the same shape and type as a given array.
12:37 Return a new array of given shape and type, filled with ones.
12:43 Now Read the statements and answer,
12:47 Only statement A is correct.
12:49 Only statement B is correct.
12:51 Both statement A and B are correct.
12:53 Both statement A and B are incorrect.
12:56 So let's find the answers,
12:59 The answer is False.
13:02 The correct way would be to assign the elements as a list of lists and then convert it to an array
13:10 Type x = array within brackets square brackets 1 comma 2 comma 3 comma within brackets 5 comma 6 comma 7
13:21 The function ones underscores like() returns an array of ones with the same shape and type as a given array.
13:29 Hope you have enjoyed this tutorial and found it useful.
13:31 Thank you!

Contributors and Content Editors

Gaurav, Minal, PoojaMoolya, Sneha