304 North Cardinal St.
Dorchester Center, MA 02124

# Python for Scientists and Engineers Educative Quiz Answers

## Get Python for Scientists and Engineers Educative Quiz Answers

If you’re a scientist or an engineer interested in learning scientific computing, this is the place to start.

In this course, you’ll learn to write your own useful code to perform impactful scientific computations. Along the way, your understanding will be tested with periodic quizzes and exercises.

Topics covered in this course include arrays, plotting, linear equations, symbolic computation, scientific algorithms, and random variables. You’ll also be exposed to popular Python packages like NumPy, Matplotlib, SciPy, and others. In the last part of the course, the application section will test your ability to recall and apply the tools you have studied into newly learned scientific concepts.

At the end of this course, you’ll be equipped with the tools necessary for everyday scientific computation.

Enroll on Educative

#### Quiz 1:

Q1. A comparison operation always returns a value of the ______ data type.

• Boolean
• String
• Integer
• Floating point

Q2. String indices can be floats.

• True
• False

Q3. The conditional statement always returns a ______.

• String
• Boolean
• Tuple
• List

Q4. What is the least number of parameters a function can have?

• 1
• 0
• 2

Q5. Which of the following keyword is used to create a lambda?

• def
• lamb
• lambda
• lbd

Q6. A while loop runs as long as its condition holds True.

• True
• False

Q7. In a dictionary, key-value pairs are indexed by _____.

• Integer
• Keys
• Values

Q8. For a given list tempList, what is the correct way of calculating its length?

• tempList.length()
• len(tempList)
• tempList.len()

#### Exercise 1: Check Sum

def check_sum(num_list, num):
for first_num in range(len(num_list)):
for second_num in range(first_num + 1, len(num_list)):
if num_list[first_num] + num_list[second_num] == num:
return True
return False

#### Quiz 2:

Q1. What is the output of the the code below:

print(np.arange(1, 50, 6))
• [ 0 6 12 18 24 30 36 42 48]
• [ 1 7 13 19 25 31 37 43 49]
• [ 1 7 13 19 25 31 37 43]
• [ 6 12 18 24 30 36 42 48]

Q2. What is the output of the following code:

np.linspace(1, 20, 5)
• [ 5. 8.75 12.5 16.25 20. ]
• [ 1. 6. 11. 16. 21.]
• [ 1. 5.75 10.5 15.25 20. ]
• [ 1. 5.5 10. 14.5 19. ]

Q3. What is the output of the following code:

x = np.array([[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]])print(np.reshape(x, (2, 6))) 
• [[1 1] [1 1] [2 2] [2 2] [3 3] [3 3]]
• [[1 1 1 1 2 2] [2 2 3 3 3 3]]
• [[1 1 1 1 2 2 2 2 3 3 3 3]]
• [[1 1 1] [1 2 2] [2 2 3] [3 3 3]]

Q4. What are the shapes of X and Y in the following code:

x = np.arange(0, 3)y = np.arange(4, 8)[X, Y] = np.meshgrid(x, y)
• X = (3, 4) Y = (3, 4)
• X = (3, 4) Y = (4, 3)
• X = (4, 3) Y = (4, 3)
• X = (4, 3) Y = (3, 4)

#### Quiz 3:

Q1. What is the output of the code?

arr = np.array([[[0, 1],                 [2, 3]],                [[4, 5],                 [6, 7]]])print(arr)
• 4
• 5
• 6
• 3

Q2. Given an array arr:

arr = np.arange(1, 100)

Which of the following commands will print multiples of 3?

Note: There can be multiple answers to this question.

• Option 1
print(arr[3: 100: 3])
• Option 2
print(arr[2: 100: 3])
• Option 3
print(arr[1: 100: 3])
• Option 4
print(arr[2: 99: 3])

Q3. What is the output of the code?

M = np.array([[ 0,  1,  2], [ 5,  6,  7], [10, 11, 12]])N = np.array([[ 0,  5, 10],[ 0, 5, 10], [ 0,  5, 10]])print(N - M * 2)
• [[ 0 3 6]
• [-10 -7 -4]
• [-20 -17 -14]]
• [[ 0 8 16]
• [-10 -2 6]
• [-20 -12 -4]]
• [[ 0 -8 -16]
• [ 10 2 -6]
• [ 20 12 4]]
• [[ 0 -9 -18]
• [ 5 -4 -13]
• [ 10 1 -8]]

Q4. What condition must be satisfied for an element-wise multiplication of a 1-D array and a 2-D array?

• Number of rows or the number of columns should match.
• Only the number of rows should match
• Only the number of columns should match
• The operation is not possible

Q5. What is the output of the code below:

arr = np.array([5, 10, 12, 4, 3, 2, 1, 6, 12, 9, 8])print(np.max(arr)) 
• 12
• [12, 12]
• (12, 2)
• 24

Q6. What is the return type of any() and all() method?

• Integer
• String
• Boolean
• Complex

Q7. What is the output of the code below?

x = np.arange(10)y = xy = 24 x = 25print(x)
• [ 0 1 2 3 4 25 6 7 8 9]
• [ 0 1 2 3 24 25 6 7 8 9]
• [ 0 1 2 3 24 5 6 7 8 9]
• The code will throw an error

#### Quiz 4:

Q1. Will the following code compile?

x = np.arange(0, 10)y = np.linspace(0, 10, 8)plt.plot(x, y)
• Yes
• No

Q2. What is the correct code to add legends to a plot?

• Option 1
plot(x1, y1, label = "curve 1")
plot(x2, y2, label = "curve 2")
legend()

• Option 2
legend()
plot(x1, y1, label = "curve 1")
plot(x2, y2, label = "curve 2")
• Option 3
plot(x1, y1, legend = "curve 1")
plot(x2, y2, legend = "curve 2")

• Option 4
plot(x1, y1, legend = "curve 1")
plot(x2, y2, legend = "curve 2")
show_legend()


Q3. The following command will split the figure into a grid with ____ rows and ____ columns.

plt.subplots(2, 4)
• rows = 4
• columns = 2
• rows = 2
• columns = 4
• rows = 2
• columns = 2
• rows = 1
• columns = 8

Q4. What does the tight_layout() command do?

• Tightens the positions of axes even if there is overlapping content.
• Automatically adjusts the positions of the axes on the figure so that there is no overlapping content
• Merges graphs in all the axes into one axis
• Creates a border around all the axes

Q5. Which of the following command can be used to to create a scatter plot?

Note: This question can have multiple answers.

• Option 1
plot(x, y, 'scatter')
• Option 2
plot(x, y, 's')
• Option 3
scatter(x, y)

• Option 4
scatter(x, y, 'plot')


#### Quiz 5:

Q1. Which of the codes solves the following set of equation?

x+y-3z=-6x+y−3z=−6

2x+3y+z=102x+3y+z=10

x+4y-4z=-6x+4y−4z=−6

• Option 1
A = np.array([[2, 3, 1], [1, 1, -3], [1, 4, -4]])
b = np.array([-6, 10, -6])

print(np.linalg.solve(A, b))

• Option 2
A = np.array([[1, 1, -3], [2, 3, 1], [1, 4, -4]])
b = np.array([10, -6, -6])

print(np.linalg.solve(A, b))
• Option 3
A = np.array([[1, 1, -3], [2, 3, 1], [1, 4, -4]])
b = np.array([-6, 10, -6])

print(np.linalg.solve(A, b))
• Option 4
A = np.array([[1, 1, -3], [1, 4, -4], [2, 3, 1]])
b = np.array([-6, 10, -6])

print(np.linalg.solve(A, b))


Q2. To compute both, eigenvectors and eigenvalues, we use the eigvals methods.

• True
• False

Q3. Suppose there is a 3×3 matrix, M. Which of the following can not be the eigenvectors returned from eig(M)?

• ⎡​⎦100​⎦⎤​
• ​⎦⎡​3​1​3​1​3​1​​⎦⎤​
• ​⎦⎡​2​1​2​1​2​1​​⎦⎤​
• ​⎦⎡​2​1​2​1​0​⎦⎤​

Q4. What is the output of the code below?

A = np.array([[2, 7, 3], [7, 9, 4], [3, 4, 7]])print(np.transpose(A))
• [[2 3 7]
• [7 4 9]
• [3 7 4]]
• [[3 2 7]
• [4 7 9]
• [7 3 4]]
• [[2 7 3]
• [7 9 4]
• [3 4 7]]
• [[7 3 2]
• [9 4 7]
• [4 7 3]]

Q5. In a sparse matrix, only the value and location of non-zero values in a matrix are stored.

• True
• False

Q6. What is the output of the following code?

import numpy as npimport scipy.sparse as spM = np.array([[0, 1, 1, 1], [1, 1, 0, 0], [1, 1, 1, 0], [0, 0, 1, 1]])print(sp.csc_matrix(M)) 
• (1, 0) 1
• (2, 0) 1
• (0, 1) 1
• (1, 1) 1
• (2, 1) 1
• (0, 2) 1
• (2, 2) 1
• (3, 2) 1
• (0, 3) 1
• (3, 3) 1
• (0, 1) 1
• (0, 2) 1
• (0, 3) 1
• (1, 0) 1
• (1, 1) 1
• (2, 0) 1
• (2, 1) 1
• (2, 2) 1
• (3, 2) 1
• (3, 3) 1

#### Quiz 6:

Q1. What is the correct code to assign mutiple symbols to variable?

Note: This question can have multiple answers.

• Option 1
x, y, z = symbols('x y z')

• Option 2
x, y, z = Symbols('x y z')
• Option 3
x = Symbol('x')
y = Symbol('y')
z = Symbol('z')
• Option 4
x = symbols('x')
y = symbols('y')
z = symbols('z')

Q2. The imaginary unit is denoted by I in Sympy.

• True
• False

Q3. What is the correct way to represent \frac{2}{5}52​ in SymPy?

• Option 1
Rational(2, 5)

• Option 2
Rational(5, 2)

• Option 3
Rational(2/5)
• Option 4
2/5

Q4. What is the output of the following code?

x = Symbol('x')a = 1/x + 1/x**2 print(together(a))
• 1/x + x**(-2)
• (x + 1)/x**2
• 1/x + 1/x**2
• None of the above

#### Quiz 7:

Q1. Which of the following will compute second derivative of the function f with respect to x?

Note: This question can have mutiple answers.

• Option 1
diff(f(x), x, x)

• Option 2
diff(f(x), xx)
• Option 3
diff(f(x), x, 2)
• Option 4
diff(f(x), x*2)

Q2. The function f(x, y)f(x,y) is given by:

f(x, y) =y^3x^3 + x^4y^2f(x,y)=y3x3+x4y2

\frac{\partial^3 f}{\partial x^2 \partial y}∂x2∂y∂3f​ can be computed using:

Note: This question can have mutiple answers.

• Option 1
diff(f(x), x, 2, y, 1)
• Option 2
diff(f(x), x, x, y)
• Option 3
diff(f(x), x, y, x)

• Option 4
diff(f(x), y, x, x)

Q3. For improper integrals in SymPy, we use the oo symbol for infinity.

• True
• False

Q4. For definite integrals, we use ____ or _____ for providing limits of integration.

• tuples or strings
• tuples or lists
• lists or dictionaries
• tuples or dictionaries

Q5. The direction of limit can be specified using which of the optional argument?

• direction
• dir
• The direction of limit cannot be specified

#### Quiz 8:

Q1. For taylor expansion of a function f(x), which of the following commands are used?

Note: This question can have mutiple answers

• Option 1
series(f(x), x)
• Option 2
expand(f(x), x)

• Option 3
f(x).series(x)
• Option 4
f(x).expand(x)

Q2. By default, the series() function expands the expression around 0.

• True
• False

Q3.

x = Symbol('x')fps_exp = fps(sin(x), x, 0)fps_exp

What does fps_exp return?

• 5^{th}5th values in the taylor series expansion of sin(x)sin(x).
• The coefficient of x^5x5 term.
• First 55 terms in the taylor series expansion of sin(x)sin(x)
• First 44 terms in the taylor series expansion of sin(x)sin(x).

Q4. Which of the following could be the output type of solve()?

Note: This question can have mutiple answers.

• list
• dictionary
• tuple
• class

Q5. solve() can only solve single variable equations equations.

• True
• False

#### Quiz 9:

Q1. quad() returns a tuple with the first value being the numerical result and the second is the estimation of the numerical error in the result.

• True
• False

Q2. In SciPy namespace, we use oo to refer to inifinity.

• True
• False

Q3. Which of the following is the correct SciPy implementation of the integral given below?

\int_0^3\int_0^2\int_0^1x y^2 z^3\space dxdydz∫03​∫02​∫01​xy2zdxdydz

• Option 1
def f(x, y, z):
return(x * y**2 * z**3 )

tplquad(f, 0, 1, lambda y : 0, lambda y : 2, lambda y, z : 0,
lambda y, z : 3)

• Option 2
def f(z, x, y):
return(x * y**2 * z**3 )

x = tplquad(f, 0, 1, lambda y : 0, lambda y : 2, lambda z : 0,
lambda z : 3)
• Option 3
def f(z, y, x):
return(x * y**2 * z**3 )

tplquad(f, 0, 1, lambda y : 0, lambda y : 2, lambda y, z : 0,
lambda y, z : 3)
• Option 4
def f(x, y, z):
return(x * y**2 * z**3 )

x = tplquad(f, (x, 0, 1),(y, 0, 2), (z, 0, 3)) 

Q4. The third argument of the interp1d() function determines the type of interpolation.

• True
• False

#### Quiz 10:

Q1. Which of the following can be the value of z if z is given by:

z = np.polyfit(x, y, 3)

Note: This question can have more than one answer.

• [1, 0, 3, 2]
• [0, 1, 3, 2]
• [1, 1, 3, 0]
• [1, 3, 0, 2]

Q2. What does poly1d do?

• Plots polynomials out from the coefficients of the polynomial
• Creates a polynomial from the polynomial coefficients.
• Generates an array of random polynomials coefficients.
• Coverts 2-dimensional polynomials into 1-dimensional polynomials.

Q3. The curve_fit function needs to be called with two neccessary arguments.

• True
• False

Q4. There are two minimum input arguments for fmin.

• True
• False

Q5. What does fminbound do?

• Finds all the minima of a function in the given range.
• It finds the minimum of the function in the given range
• Returns all the values of a function in a given range
• None of the above

Q6. Fourier transform computes the peaks only in the postive frequency domain

• False
• True

#### Quiz 11:

Q1. Which of the following could be the output of the code below:

print(rnd.randint(0, 1, 10))

Note: This question can have more than one answers

• [0 0 1 0 0 1 1 0 0 0]
• [0 0 0 0 0 0 0 0 0 0]
• [0 1 1 1 1 1 0 0 0 0]
• [1 0 0 0 0 1 0 1 1 1]

Q2. The code below

rnd.seed(10)print(rnd.randint(0, 2, 10))

produces

[1 1 0 1 0 1 1 0 1 1]

Does this output change when we run the code again?

• Yes
• No

Q3. Which of the following can not be the output of the code below:

arr = np.arange(1, 11) pick = rnd.choice(arr, 3, replace=False)

Note: This question can have more than one asnwers

• [6 1 9]
• [6 9 9]
• [9 9 9]
• [9 1 6]
• [6 6 9]
• [1 9 6]

Q4. comb() is part of which package?

• numpy.random
• scipy.special
• numpy.linalg
• matplotlib.pyplot

Q5. Which of the following command produces an array of size = 100, mean = 3, and standard deviation = 2.4?

• Option 1
rnd.normal(loc = 2.4, scale = 3, size = 100)
• Option 2
rnd.normal(loc = 3, scale = 2.4, size = 100)
• Option 3
rnd.normal(mean = 3, sd = 2.4, size = 100)
• None of the above

Q6. The hist() function creates a histogram graph and returns a tuple of three items

• True
• False

#### Python for Scientists and Engineers Exam

Q1. What will be the output of the following code:

arr = (0, 1, 2, 3, 4)for i in range(0, len(arr)):  arr[i] = arr[i] ** 2print(arr)
• [0, 1, 4, 9, 16]
• [2, 2, 2, 2, 2]
• [0, 2, 4, 6, 8]
• The code will produce an error

Q2. What will be the output of the following code:

num = 12while (num < 13):   if (num == 12):     num = 10  if (num == 10):    num = 8  if (num == 8)    num = 6  else:     num = 14 print(num) 
• 6
• 12
• 14
• The code will produce a syntax error.

Q3. What will be the output of the following code?

name = "Python"def func(n):  n = "Educative"  print(n)func(name)print(name)
• Educative Python
• Python Educative
• Educative Educative
• Python Python

Q4. See the code below:

import numpy as npa = np.arange(10)

Which one of the commands will print the output below?

[6 7 8]
• print(a[(a > 5) & (a < 9)])
• print(a[(a > 5) and (a < 9)])
• print((a > 5) and (a < 9))
• print((a > 5) & (a < 9))

Q5. What will be the output of the following code?

import numpy as npa = np.arange(5)b = a       b = 55print(a) 
• [0 1 2 3 4]
• [ 0 1 2 55 4]
• [ 0 1 2 3 55]
• [ 55 55 55 55 55]

Q6. What will be the output of the following code:

import numpy as npx = np.array([1, 3, 5, 7, 9])y = np.ones(5)z = np.zeros(5) + 2a = x + y * zprint(a)
• [0. 0. 0. 0. 0.]
• [1. 3. 5. 7. 9.]
• [ 3. 5. 7. 9. 11.]
• [ 4. 8. 12. 16. 20.]

Q7. For the add_axes(x, y, w, h) command, what are the correct value ranges for xyw, and h?

• -1 to 1
• -10 to 10
• 0 to 1
• 0 to 10

Q8. For which of the commands below, the following code will color the area between y=3x^3y=3x3 and the y=x^3y=x3 curves?

import numpy as npimport matplotlib.pyplot as pltx = np.linspace(0, 10, 100)fig, axes = plt.subplots(figsize=(12, 8))
• axes.fill(x, 3 * x**3, x**3)
• axes.color(x, 3 * x**3, x**3)
• axes.fill_between(x, 3 * x**3, x**3)
• axes.between(x, 3 * x**3, x**3)

Q9. How many curves will the following code produce?

import numpy as npimport matplotlib.pyplot as pltx = np.linspace(0, 2 * np.pi , 100)y1 = np.sin(x)y2 = np.cos(x + np.pi/2)plt.plot(x, y1)     plt.plot(x, y2)   
• 0
• 1
• 2
• The code will throw an error.

Q10. What is the output of the following code?

import numpy as npA = np.array([[10, 0, 0], [0, 20, 0], [0, 0, 30]])print(np.linalg.eigvals(A))
• [1. 2. 3.]
• [10. 20. 30.]
• 1. 2. 3.
• 10. 20. 30.

Q11. What is the output of the following code?

import numpy as npA = np.array([[1, 0, 3], [2, 2, 0], [0, 2, 2]])B = np.transpose(A)C = A + Bprint(np.trace(C))
• 5
• 10
• 4
• 32

Q12. Which of the following Python commands will solve the below systems of linear equations?

\begin{bmatrix} 1 & 3& 1\\ 4 & 4 & 2\\ 2 & 1 & -1 \end{bmatrix} \begin{bmatrix} x\\ y\\ z \end{bmatrix} =\begin{bmatrix} 17\\ 25\\ 6 \end{bmatrix}⎣⎡​142​341​12−1​⎦⎤​⎣⎡​xyz​⎦⎤​=⎣⎡​17256​⎦⎤​

Here is a part of the code:

import numpy as npA = np.array([[1, 3, 1], [4, 4, 2], [2, 1, -1]])b = np.array([17, 25, 6])
• x = np.solve(b, A)
• x = np.solve(A, b)
• x = np.linalg.solve(b, A)
• x = np.linalg.solve(A, b)

Q13. What is the output of the following code?

from sympy import *def f(x):   return (x**2 + 2*x + 4)def g(x):   return (sin(x) + cos(x))    x = Symbol('x')print(diff(f(x), x) + diff(g(x), x))
• 2*x – sin(x) + cos(x) + 2
• – sin(x) + cos(x)
• 2*x + 2
• The code will throw an error.

Q14. Taylor series of sin(x)sin(x) around 00 is given below:

x-\frac{1}{3!}x^3+\frac{1}{5!}x^5-\frac{1}{7!}x^7+\frac{1}{9!}x^9+\ldots \:x−3!1​x3+5!1​x5−7!1​x7+9!1​x9+…

What is the output of the following code?

from sympy import *x = Symbol('x')fps_sin = fps(sin(x), x, 0).truncate(3).removeO()print(fps_sin)
• x
• -x**3/6 + x
• x**5/120 – x**3/6 + x
• None of the above

Q15. What is the output of the following code?

from sympy import *def f(x):    return sin(x) / xx = Symbol('x')print(limit(f(x), x, 0))
• 0
• 1
• -1
• infinite

Q16. What is the output of the following code?

from sympy import *a, b, c = symbols('x y z')print(a + b + c)
• x + y + z
• a + b + c
• xyz
• abc

Q17. Which command will yield the correct result for the following integral?

\int _0 ^3 \int _0 ^2 x^2y^3 \space dxdy∫03​∫02​x2ydxdy

Here is the function defined in the code:

def f(y, x):  return x**2 * y**3
• dblquad(f, 0, 2, 0, 3)
• dblquad(f, 0, 2, lambda x: 0, lambda x: 3)
• dblquad(f, lambda y: 0, lambda y: 2, lambda x: 0, lambda x: 3)
• dblquad(f, 0, 3, lambda x: 0, lambda x: 2)

Q18. What is the output of the following code?

import numpy as npx = np.linspace(-10, 11, 20)y = (0.2 * x**2 + x + 2)  z = np.polyfit(x, y, 3)        print(len(z))
• 1
• 2
• 3
• 4

Q19. See a graph for the data collected for an experiment:

To interpolate using the interp1d function, what is the best possible value for kind for the data in the graph above?

y0 = interp1d(x, y, kind='') 
• linear
• cubic
• None of the above

Q20. What is the output of the following code?

import scipy as scx = sc.arange(0, 25, 3) print(x)
• [ 0 3 6 9 12 15 18 21]
• [ 1 4 7 10 13 16 19 22]
• [ 0 3 6 9 12 15 18 21 24]
• [ 1 4 7 10 13 16 19 22 25]

Q21. What could not be a possible output of the following code?

import numpy.random as rndprint(rnd.randint(0, 4 + 1, 10))
• [5 1 3 1 1 0 4 5 1 2]
• [2 1 1 2 1 1 3 2 0 4]
• [1 0 2 1 1 2 1 2 2 0]
• [3 1 3 3 1 0 2 1 3 0]

Q22. What are the possible values of pick in the following code?

import numpy as npimport numpy.random as rndarr = np.arange(1, 5) pick = rnd.choice(arr, 4, replace = True)
• [1 2 3 4]
• [1 2 4 4]
• [1 2 4 3]
• [4 2 3 1]

Q23. Which of the following is least likely to be a possible outcome of the code below:

import numpy as npimport numpy.random as rnddata = rnd.normal(loc=6, scale=2, size=1000)  # Array with 100 valuesprint(np.mean(data))print(np.std(data))
• 6.017170979598125 2.0669869351183348
• 6.026923785137937 1.9591830782723343
• 5.964201366853884 0.9852300530478677
• 6.03014758949557 1.9860037745207995

Q24. Running the code below produces the following output the first time:

import numpy.random as rndrnd.seed(40)flips = rnd.randint(0, 1+1, 10)    print(flips)
##### Output
[0 1 1 1 0 0 0 1 0 1]

What will be the output when the code is run for the third time?

• [1 0 1 1 0 0 1 0 1 0]
• [0 1 1 1 0 0 0 1 0 1]
• [1 1 1 1 0 0 1 0 1 1]
• [1 1 0 1 0 1 1 0 1 1]

Q25. In Python, an arithmetic expression containing different operators will be computed on the basis of operator precedence.

• True
• False

Q26. If there is an operation between two matrices, they should have exactly the same shape.

• True
• False

Q27. To plot a three-dimensional curve, set the keyword projection to ‘3d’ when creating the axis.

• True
• False

Q28. The SymPy polyfit() function returns a dictionary containing the coefficients of the polynomial.

• True
• False

Q29. SymPy solve() is just limited to solving a single variable equation, it cannot also solve a system of multivariable equations.

• True
• False

Q30. Match the blanks with the correct data type.

• The SymPy subs() method takes a ________ as an input with the variables and its associated values.
• In the SymPy integration() function, definite integrals can be computed by providing a ______ having the variable of integration, and the limits of integration
• The output type of the SymPy solve() function for a single variable equation is a ________.
• The output type of the SymPy solve() function for a multivariable equation is a ________.
• tuple
• dictionary
• list

Q31. Implement a function has_duplicates(arr) which takes a list of integers and returns True if the list has duplicates and returns False if the list has no duplicates.

Below are the sample inputs and outputs forhas_duplicates(arr):

##### Sample inputs
has_duplicates([1, 2, 3, 1])has_duplicates([1, 2, 3, 4])has_duplicates([1, 1, 1, 1])
##### Sample outputs
TrueFalseTrue

Q32. Write a function maximum which takes in the complex NumPy array and returns a tuple containing the maximum value

##### Sample input
arr = numpy.array([2+5j, 3+4j, 8-2j], dtype="complex")a = maximum(arr)print(a)
##### Sample output
(8.0, -3.0)

Q33. Solve the following system of linear equations:

3a +2b-c+d+e=163a+2bc+d+e=16

a+ b + c+ 2d-e=9a+b+c+2de=9

a+2b+2c+2d-4e=1a+2b+2c+2d−4e=1

3a+2b-2c+4d+e=263a+2b−2c+4d+e=26

a+b+c+d-e=5a+b+c+de=5

Store the exact values of the unknowns in their corresponding variables.

For example, the exact value of aa should be stored in a, the exact value of bb should be stored in the variable b and so on.

Q34. Integrating complex single fractions can be a hassle. To accommodate for this, we convert these fractions into a sum of partial fractions and then integrate each partial fraction.

Convert the following function to partial fractions, store it in the variable partial_fraction and then integrate it indefinitely:

\int_2^4 \frac{4x^3+10x+4}{x(2x+1)} \space dx∫24​x(2x+1)4x3+10x+4​ dx

Store the indefinite integral in the variable indefinite_integral and final answer of the integration in the variable result. The final result, result, should be a float of 44 significant figures.

Q35. Write a Python function throw which takes in the two input arguments: seed and the number of throws. The function returns a dictionary containing probabilities of each number on the dice. The 0 index corresponds to the probability of 11 on the dice

##### Sample input
print(throw(30, 50))
##### Sample output
{'1': 0.12, '2': 0.22, '3': 0.1, '4': 0.16, '5': 0.18, '6': 0.22}

Q36. Using the SymPy quad, write a function func_area(n) to compute the area under the following function from x=0x=0 to x=nx=n:

f(x)=x^2f(x)=x2

where n \geq 0n≥0.

Below are the sample inputs and sample outputs for func_are(n).

##### Sample inputs
func_n(0)func_n(3)func_n(6)
##### Sample outputs
0.09.00000000000000272.00000000000001

##### Conclusion:

I hope this Python for Scientists and Engineers Educative Quiz Answers would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions