1.
2. What is the correct syntax to output the type of a variable or object in Python?
Syntax of the Python type() functionThe type() function
3. upper() 全大写
lower() 全小写
4.
接下来是Numpy部分
1. What is a correct syntax to check the number of dimensions in an array?
arr.ndim
2. What is a correct syntax to check the data type of an array?
3. copies and views
Copies and views
When operating on NumPy arrays, it is possible to access the internal data buffer directly using a view without copying data around. This ensures good performance but can also cause unwanted problems if the user is not aware of how this works. Hence, it is important to know the difference between these two terms and to know which operations return copies and which return views.
The NumPy array is a data structure consisting of two parts: the contiguous data buffer with the actual data elements and the metadata that contains information about the data buffer. The metadata includes data type, strides, and other important information that helps manipulate the ndarray easily. See the Internal organization of NumPy arrays section for a detailed look.
读这篇:Copies and views — NumPy v1.26 Manual
4. What is a correct syntax to return the shape of an array?
5. What is a correct method to search for a certain value in an array?
6. When using the NumPy random
module, how can you return a random number from 0 to 100?
7.