-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathran.py
More file actions
24 lines (21 loc) · 652 Bytes
/
ran.py
File metadata and controls
24 lines (21 loc) · 652 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# so i'd like to use the same into my code, but got error message saying:
#"AttributeError: 'bool' object has no attribute 'all'. i think it's because of "mymap" which was not taken as a ready-to-use matrix
#
# rows = int(input("# of rows "))
# cols = int(input("# of cols "))
#
# mymap = [0] * rows
# for i in range(0, rows):
# mymap[i] = [0] * cols
# for i in range(0, rows):
# for j in range(0, cols):
# mymap[i][j] = input("enter each element and press enter ")
mymap = [[0,1,0,0],
[1,1,1,0],
[0,1,0,0],
[1,1,0,0],
[0,0,0,0]]
print ("this is your map: ", mymap)
import numpy as np
a = np.array(mymap)
print(a[~(a==0).all(1)])