-1

I have written my code like this:

import random
a = []
for i in range(10):
    for j in range(10):
        a.append(random.randint(0,100))
x = np.shape(a)
print(a)

This is my output:

[[], 79, 46, 29, 48, 88, 43, 57, 53, 70, 55, 89, 19, 49, 11, 79, 41, 76, 82, 90, 91, 21, 86, 67, 80, 93, 13, 38, 51, 27, 43, 50, 79, 87, 23, 27, 1, 64, 43, 81, 67, 48, 35, 9, 50, 48, 70, 73, 94, 58, 75, 60, 43, 73, 88, 51, 12, 74, 88, 72, 83, 100, 7, 10, 50, 13, 64, 74, 37, 76, 44, 37, 46, 42, 20, 20, 100, 81, 11, 83, 27, 76, 29, 15, 3, 18, 81, 5, 34, 85, 99, 88, 53, 75, 53, 12, 19, 62, 1, 51, 44]

It is a 10 x 10 array. The first value is an array and 99 rest of the values. Can anyone help me solve this issue?

0

1 Answer 1

1

Try this:

import random
[[random.randint(0,100) for i in range(10)] for j in range(10)]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.