9
Jason Gordon
Last seen 3 years ago
Member for 9 years, 2 months, 21 days
Difficulty Normal
I have been a social sciences teacher for the past 15 years and am just now trying to learn to code. Midlife crisis maybe?
itertools eh? Looks like something for this newbie to look up.
More
Well done. I am still trying to understand how it works. So you iterate through the tuple pairs in your NEIGHBOURS list checking first to see if the row is within the boundaries of the grid, then the same for the columns and then to see which "neighbours" of the actual target cell contains a 1 (and
More
I can't see all of your code, but thank you for pointing me in the direction of chr and ord. I converted my positions to coordinates by creating a blank "board" first, but only because I didn't think of using the "values" of the letters.
More
It is strange. I started out with the same basic code but kept getting an error that I was trying to index using a float -- even when using int. The only way I could get it to work was by using // which I just learned returns and int (kind of like .floor)
More
This was the same approach I had, except that I saved the "has_length" check for the boolean comparison at the end. I think yours is more efficient because it exits before having to check the other conditions. Thanks for helping me see that.
More
Interesting. I am not familiar with the re module and therefore re.search(). It certainly makes your code very straight forward and readable. Nice job.
More
I like you you checked for the len of the first list item. I just used 3, but checking for the length could help adapt this to take varying grid sizes.
More
I am not sure that I understand your first for loop. You fill your result list with the items for game_results, but than you append numbers (as strings) to the list as well? Sorry I am new and any explanation would be helpful, thanks.
More
What are the asserts at the top of your code used for? May sound stupid from a newbie, but can you explain what this code does? Thanks.
More
Excellent! When am I going to learn to index from the other end? Thanks for the education!
More