Q:

Write a NumPy program to create a 90x30 array filled with random point numbers, increase the number of items (10 edge elements) shown by the print statement

0

Write a NumPy program to create a 90x30 array filled with random point numbers, increase the number of items (10 edge elements) shown by the print statement.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np 
nums = np.random.randint(10, size=(90, 30))
print("Original array:")
print(nums)
print("\nIncrease the number of items (10 edge elements) shown by the print statement:")
np.set_printoptions(edgeitems=10)
print(nums)

Sample Output:

Original array:
[[1 8 3 ... 9 5 8]
 [1 9 6 ... 6 5 0]
 [0 0 8 ... 6 9 8]
 ...
 [2 3 9 ... 4 0 1]
 [2 6 8 ... 8 3 4]
 [1 2 9 ... 7 4 8]]

Increase the number of items (10 edge elements) shown by the print statement:
[[1 8 3 0 1 2 8 0 0 5 ... 1 3 8 1 1 7 5 9 5 8]
 [1 9 6 1 0 7 7 3 8 6 ... 5 9 9 9 9 7 2 6 5 0]
 [0 0 8 1 4 2 1 3 2 9 ... 5 6 4 1 4 9 0 6 9 8]
 [7 2 7 1 7 2 4 7 2 0 ... 4 2 6 2 6 4 4 0 6 7]
 [3 6 0 0 2 1 6 6 2 9 ... 3 4 1 9 5 7 4 4 6 7]
 [9 5 2 6 9 2 7 7 9 6 ... 4 3 5 2 7 0 6 0 2 7]
 [5 5 4 1 9 2 5 3 5 2 ... 7 4 7 5 5 7 3 0 1 8]
 [5 9 9 9 6 3 5 0 9 4 ... 6 4 9 7 8 7 2 5 9 4]
 [6 1 0 8 9 8 0 6 6 3 ... 5 3 1 6 1 5 2 9 8 3]
 [3 0 3 1 4 1 4 1 9 6 ... 3 9 4 4 5 0 2 0 8 0]
 ...
 [3 9 5 0 3 8 5 3 1 1 ... 1 2 4 6 2 4 5 0 0 5]
 [7 9 7 0 1 3 0 1 8 4 ... 5 7 5 4 7 2 0 2 3 0]
 [4 2 6 4 7 2 3 9 7 9 ... 2 7 1 2 5 7 5 4 0 2]
 [7 8 9 7 3 3 1 2 8 5 ... 1 9 9 5 5 2 3 5 0 1]
 [3 7 6 8 3 2 5 0 5 4 ... 0 4 9 8 5 3 2 1 3 3]
 [3 3 8 4 0 4 8 4 7 0 ... 7 5 0 9 7 8 2 0 7 9]
 [8 4 4 7 3 8 2 0 8 9 ... 5 5 8 1 5 6 0 6 5 0]
 [2 3 9 9 9 8 6 5 4 4 ... 4 0 7 1 8 6 7 4 0 1]
 [2 6 8 7 3 3 8 4 1 6 ... 1 3 9 5 0 1 4 8 3 4]
 [1 2 9 5 1 2 9 9 5 4 ... 3 1 2 6 1 4 4 7 4 8]]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now