Knowee
Questions
Features
Study Tools

.Question 1What is the result of the following lines of code?123a=np.array([-1,1])b=np.array([1,1])np.dot(a,b) 1 pointarray([0,2])102.Question 2What is the value of Z after the following code is run?12345 X=np.array([[1,0],[0,1]])Y=np.array([[0,1],[1,0]])Z=X+Y 1 pointarray([[1,1],[1,1]])array([[1,0],[0,1]])array([[0,1],[1,1]])3.Question 3What values does the variable out take if the following lines of code are run?12345 X=np.array([[1,0,1],[2,2,2]]) out=X[0,1:3]out 1 pointarray([1,0,1])array([2,2])array([0,1])4.Question 4What is the value of Z after the following code is run?12345 X=np.array([[1,0],[0,1]])Y=np.array([[2,1],[1,2]]) Z=np.dot(X,Y) 1 pointarray([[2,1],[1,2] ])array([[2,0],[1,0]])array([[3,1],[1,3] ])5.Question 5Consider the following text file: Example1.txt:This is line 1This is line 2This is line 3What is the output of the following lines of code?123456 with open("Example1.txt","r") as file1:      FileContent=file1.read()        print(FileContent)1 pointThis is line 1This is line 2This is line 3This is line 1This6.Question 6What do the following lines of code do?1234567 with open("Example1.txt","r") as file1:    FileContent=file1.readlines()   print(FileContent) 1 pointRead the file "Example1.txt"Write to the file “Example1.txt”Append the file "Example1.txt"7.Question 7What do the following lines of code do?123456 with open("Example.txt","w") as writefile:    writefile.write("This is line A\n")  writefile.write("This is line B\n") 1 pointRead the file "Example.txt"Write to the file “Example.txt”Append the file "Example.txt"8.Question 8What do the following lines of code do?12345 with open("Example3.txt","w") as file1:  file1.write("This is line C\n") 1 pointRead the file "Example3.txt".Append the file "Example3.txt".error9.Question 9Consider the dataframe df. How would you access the element in the 1st row 3rd column1 pointdf.iloc[2,0]df.iloc[1,3]df.iloc[0,2]10.Question 10What function would you use to load a csv file in Pandas?1 pointpd.read_csvpd.read_excel

Question

.Question 1What is the result of the following lines of code?123a=np.array([-1,1])b=np.array([1,1])np.dot(a,b) 1 pointarray([0,2])102.Question 2What is the value of Z after the following code is run?12345 X=np.array([[1,0],[0,1]])Y=np.array([[0,1],[1,0]])Z=X+Y 1 pointarray([[1,1],[1,1]])array([[1,0],[0,1]])array([[0,1],[1,1]])3.Question 3What values does the variable out take if the following lines of code are run?12345 X=np.array([[1,0,1],[2,2,2]]) out=X[0,1:3]out 1 pointarray([1,0,1])array([2,2])array([0,1])4.Question 4What is the value of Z after the following code is run?12345 X=np.array([[1,0],[0,1]])Y=np.array([[2,1],[1,2]]) Z=np.dot(X,Y) 1 pointarray([[2,1],[1,2] ])array([[2,0],[1,0]])array([[3,1],[1,3] ])5.Question 5Consider the following text file: Example1.txt:This is line 1This is line 2This is line 3What is the output of the following lines of code?123456 with open("Example1.txt","r") as file1:      FileContent=file1.read()        print(FileContent)1 pointThis is line 1This is line 2This is line 3This is line 1This6.Question 6What do the following lines of code do?1234567 with open("Example1.txt","r") as file1:    FileContent=file1.readlines()   print(FileContent) 1 pointRead the file "Example1.txt"Write to the file “Example1.txt”Append the file "Example1.txt"7.Question 7What do the following lines of code do?123456 with open("Example.txt","w") as writefile:    writefile.write("This is line A\n")  writefile.write("This is line B\n") 1 pointRead the file "Example.txt"Write to the file “Example.txt”Append the file "Example.txt"8.Question 8What do the following lines of code do?12345 with open("Example3.txt","w") as file1:  file1.write("This is line C\n") 1 pointRead the file "Example3.txt".Append the file "Example3.txt".error9.Question 9Consider the dataframe df. How would you access the element in the 1st row 3rd column1 pointdf.iloc[2,0]df.iloc[1,3]df.iloc[0,2]10.Question 10What function would you use to load a csv file in Pandas?1 pointpd.read_csvpd.read_excel

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here are the answers to your questions:

  1. The result of the dot product of arrays a and b is 0.

  2. After running the code, the value of Z will be array([[1,1],[1,1]]).

  3. The variable 'out' will take the values array([0,1]).

  4. The value of Z after running the code will be array([[2,1],[1,2]]).

  5. The output of the code will be: This is line 1 This is line 2 This is line 3

  6. The lines of code read the file "Example1.txt".

  7. The lines of code write to the file “Example.txt”.

  8. The lines of code write to the file "Example3.txt".

  9. To access the element in the 1st row 3rd column, you would use df.iloc[0,2].

  10. To load a csv file in Pandas, you would use the function pd.read_csv.

This problem has been solved

Similar Questions

X=np.array([[1,0],[0,1]])Y=np.array([[2,2],[2,2]])Z=np.dot(X,Y)

What values does the variable out take if the following lines of code are run?45123out  X=np.array([[1,0,1],[2,2,2]]) out=X[0,1:3]0 / 1 pointarray([2,2])array([1,0,1])array([0,1])

what is the result of the following lines of code:a=np.array([0,1])b=np.array([1,0])print( a @b )

What is the result of the following lines of code? a=np.array([1,1,1,1,1]) a+11 pointarray([11, 11, 11, 11, 11])array([1,1,1,1,1])array([2,2,2,2,2])

Question 20What is the result of the following lines of code? a=np.array([0,1,0,1,0]) b=np.array([1,0,1,0,1]) a/b 1 pointarray([0.1, 1.0, 0.1, 1.0, 0.1])array([1, 1, 1, 1, 1])Division by zero error

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.