import numpy as np
a = np.array([[1, 2], [3, 4], [5, 6]])
b = a.flatten()
print(len(a), len(b))
Python Test 2
Quiz
•
Computers
•
University
•
Medium
Peter Parfenov
Used 1+ times
FREE Resource
19 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
import numpy as np
a = np.array([[1, 2], [3, 4], [5, 6]])
b = a.flatten()
print(len(a), len(b))
6 2
2 3
3 6
3 2
2.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
What do you expect from this code (more than 1 answer)?
import numpy as np
a = np.arange(4)
b = a / 0
print(b)
[nan nan nan]
[nan inf inf inf]
Zero Division Warning
[inf inf inf inf]
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
import numpy as np
a = np.linspace(1, 3, 3) ** 3
x = a > 20
print(x)
[False False True]
[True True False]
[True True True]
[False False False]
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
import numpy as np
x1 = np.linspace(0, 5, 5, endpoint=False)
y1 = np.linspace(0, 5, 5, endpoint=True)
x2 = np.linspace(0, 5, 5, endpoint=False)
y2 = np.linspace(0, 4, 5, endpoint=True)
print(np.sum(x1) == np.sum(y1), np.sum(x2) == np.sum(y2))
[True True]
[False False]
[True False]
[False True]
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
import numpy as np
a = np.arange(2)
b = np.arange(2, 0, -1)
print(a == b)
[False True]
[True True]
[False False]
[True False]
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
import numpy as np
a = np.array(((1, 0, 1), (0, 1, 0)))
print(a.size)
3
2
6
(2, 6)
(2, 3)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
import numpy as np
a = np.array(((1, 0, 1), (0, 1, 0)))
print(a.ndim)
2
3
6
(2, 3)
(2, 6)
17 questions
PYTHON-QUIZ-2023
Quiz
•
University
20 questions
Numpy
Quiz
•
University
20 questions
GirlsWhoML Workshop 0
Quiz
•
University
15 questions
numpy library
Quiz
•
University
21 questions
Libreria numpy python
Quiz
•
University
15 questions
ATP_AIML_D1_Reflections
Quiz
•
University - Professi...
20 questions
MÓDULOS Y PAQUETES PARA MACHINE LEARNING CON PYTHON
Quiz
•
University
15 questions
Data Analytics using Python - Quiz 2
Quiz
•
University
25 questions
Equations of Circles
Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)
Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System
Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice
Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers
Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons
Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)
Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review
Quiz
•
10th Grade