Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python 3 Write a function find.starman ) that takes one argument: board, which i

ID: 3595713 • Letter: P

Question

Python 3

Write a function find.starman ) that takes one argument: board, which is a list that consists five sub-list:s and which represents the game board. Your function should scan through the game board, then return the coordinates of Starman in the format of a list that looks like this: [row number, column number]. Please note that these are the real row and column numbers, not the indexes in the board list. For example, if Starman is located at board[0] [1] when represented by the indexes, this means that Starman is on row one, and column two, thus you should returrn Note: If Starman can not be found in the board, your function should return [-1,-1]. However, you may assume that there will be at most one starman on the board, meaning there will be no case when there is two or more starmans on the board at the same time Examples: board! = [[,*,, ,.,, ,.,, ,.,, ,.'], board2= [[,.,, ,W', 'W', 'W', 'W'], board3= [[,0, , ,.,, ,.,, ,.,, ,.'], Function Call find.starman (boardi) [1, 1] find.starman (board2) [4, 3] find starman (board3)[2, 2] Return Value

Explanation / Answer

def find_starman(board):
for i in range(len(board)):
for j in range(len(board[i])):
if board[i][j] == '*':
return [i+1, j+1]
return [-1, -1]

# copy pastable version: https://paste.ee/p/afoD6