Writing a function to calculate scores

Rustom Mody rustompmody at gmail.com
Wed May 20 01:13:31 EDT 2015


On Wednesday, May 20, 2015 at 9:21:51 AM UTC+5:30, Grace Anne St Clair-Bates wrote:
> Hello! I am trying to write a funtion that calculates scores of three random dots on a "bean-bag" board that land on different holes. Each hole holds a certain amount of point. I need to take where the computer has randomly places three points in my turtle graphic and calculate the total score. I have no idea how to do this. Please help if you can! Its really hard to explain it, but if anyone has the slightest idea please let me know. Thanks!

Lets say your board of 3 rows and 4 columns has points thusly:

2 4 6 5
1 2 1 7
3 4 5 8

You could represent it in python like so

board = [[2,4,6,5],[1,2,1,7],[3,4,5,8]]

And you can get to the 7 with the expression:  board[1][3]

(Remember in programming we usually count from 0 not 1)

Does this help any?



More information about the Python-list mailing list