janboone / programming_for_economists

3 stars 4 forks source link

Question Assignment 2 #10

Closed jorntax closed 5 years ago

jorntax commented 5 years ago

Hello, I have a question about assignment 2. Sometimes it gives outside_options with one and sometimes with 2 numbers. For example outsideoptions[1] and outside_options[1][0]. I don't really get what these 1's, 2's and 0's stand for.

What I don't get either is that when they implement a third period into the game, is that they add the variable offer[4], instead of offer[3].

janboone commented 5 years ago

the 1's, 2's and 0's stand for indexing of an array. Take an array or list x = [1,2,3,4]

Then consider what happens with x[0], x[2] etc.

If you wonder what outside_options[2][1] does, break it up in steps:

first evaluate: outside_options

then consider: outside_options[2]

and finally evaluate outside_options[2][1]

Do you see what the indexing does?

jorntax commented 5 years ago

Okey, thankyou!