You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.4 KiB

For this exercise, as the results may change depending on the version of the package or the OS, I give the code to correct the exercise. If the code is correct and the output is not the same as mine, it is accepted.

  1. The solution is accepted if the solution is: np.random.seed(888)

  2. The solution is accepted if the solution is np.random.randn(100). The value of the first element is 0.17620087373662233.

  3. The solution is accepted if the solution is np.random.randint(1,11,(8,8)).

    Given the NumPy version and the seed, you should have this output:
    
    array([[ 7,  4,  8, 10,  2,  1,  1, 10],
        [ 4,  1,  7,  4,  3,  5,  2,  8],
        [ 3,  9,  7,  4,  9,  6, 10,  5],
        [ 7, 10,  3, 10,  2,  1,  3,  7],
        [ 3,  2,  3,  2, 10,  9,  5,  4],
        [ 4,  1,  9,  7,  1,  4,  3,  5],
        [ 3,  2, 10,  8,  6,  3,  9,  4],
        [ 4,  4,  9,  2,  8,  5,  9,  5]])
    
  4. The solution is accepted if the solution is np.random.randint(1,18,(4,2,5)).

    Given the NumPy version and the seed, you should have this output:
    
    array([[[14, 16,  8, 15, 14],
            [17, 13,  1,  4, 17]],
    
        [[ 7, 15,  2,  8,  3],
            [ 9,  4, 13,  9, 15]],
    
        [[ 5, 11, 11, 14, 10],
            [ 2,  1, 15,  3,  3]],
    
        [[ 3, 10,  5, 16, 13],
            [17, 12,  9,  7, 16]]])