1 Star 0 Fork 1

WhiteCloudTemple / PythonProgramming

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
003.md 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
WhiteCloudTemple 提交于 2020-03-24 10:49 . Update NumPy 002-010

NumPy 练习题 003

在线运行/下载

题目

  1. Create a checkerboard 8x8 matrix using the tile function

  2. Normalize a 5x5 random matrix

  3. Create a custom dtype that describes a color as four unsigned bytes (RGBA)

  4. Multiply a 5x3 matrix by a 3x2 matrix (real matrix product)

  5. Given a 1D array, negate all elements which are between 3 and 8, in place.

  6. What is the output of the following script?

    # Author: Jake VanderPlas
    
    print(sum(range(5),-1))
    from numpy import *
    print(sum(range(5),-1))
  7. Consider an integer vector Z, which of these expressions are legal?

    Z**Z
    2 << Z >> 2
    Z <- Z
    1j*Z
    Z/1/1
    Z<Z>Z
  8. What are the result of the following expressions?

    np.array(0) / np.array(0)
    np.array(0) // np.array(0)
    np.array([np.nan]).astype(int).astype(float)
  9. How to round away from zero a float array ?

  10. How to find common values between two arrays?

打卡模版

ID:

21. Create a checkerboard 8x8 matrix using the tile function
    ```python
    ```
22. Normalize a 5x5 random matrix
    ```python
    ```
23. Create a custom dtype that describes a color as four unsigned bytes (RGBA)
    ```python
    ```
24. Multiply a 5x3 matrix by a 3x2 matrix (real matrix product)
    ```python
    ```
25. Given a 1D array, negate all elements which are between 3 and 8, in place. 
    ```python
    ```
26. What is the output of the following script?
    ```python
    # Author: Jake VanderPlas

    print(sum(range(5),-1))
    from numpy import *
    print(sum(range(5),-1))
    ```
    ```python
    ```    
27. Consider an integer vector Z, which of these expressions are legal?
    ```python3
    Z**Z
    2 << Z >> 2
    Z <- Z
    1j*Z
    Z/1/1
    Z<Z>Z
    ```
    ```python
    ```   
28. What are the result of the following expressions?
    ```python
    np.array(0) / np.array(0)
    np.array(0) // np.array(0)
    np.array([np.nan]).astype(int).astype(float)
    ```
    ```python
    ```    
29. How to round away from zero a float array ? 
    ```python
    ```
30. How to find common values between two arrays?
    ```python
    ```
Python
1
https://gitee.com/white-cloud-temple/pp.git
git@gitee.com:white-cloud-temple/pp.git
white-cloud-temple
pp
PythonProgramming
master

搜索帮助