I don't understand the problem of receiving a list of positions (0,...99, see below) as input and creating a function print_dots that displays '' in the corresponding position for the 10 10th square.
0 1 2 3 4 5 6 7 8 9 point_dots([0,1]) → *
10...19
20...29
·
·
·
90...99
That's how you hit * at the corresponding place in a 10x10 matrix.I would appreciate it if you could let me know.
python windows
import random
N = 10
defpoint_dots(points):
board=[']*N**2
for pin points:board[p] = '*'
print(f'{".join(map(str,range(N))))}')}')
print('\n'.join(f'{i}{ ".join(r)}'for i, lin enumerate(zip(*[iter(board)]*N)))))
if__name__=='__main__':
points=random.sample(range(100), k=7)
print(points)
point_dots(points)
© 2024 OneMinuteCode. All rights reserved.