[Tutor] Help finishing a function

Alan Gauld alan.gauld at yahoo.co.uk
Wed May 17 18:54:52 EDT 2017


Please use Reply-All or Reply-List when replying to the list,
otherwise it only goes to me.

On 17/05/17 17:21, Grace Sanford wrote:
> Syntactically speaking, how can I check if an element in the list
> "board" at position p equals "_" and then change that element to "0"?

You can use the == operator:

if board[index] == "_":
    board[index] = "O"
else:
   # report an error? return false?


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list