In slice notation, negative indices will roll over to count from the end of the array instead of the start. Next is the stop value which says at what index to end the slice, in this case it’s -1, so what does this mean? LOADING SCREEN SNAKE GAME CODESlice notation in Python looks like this: x, and in our code above we’re omitting the start value (which defaults to 0) by just putting a colon ( :). The special after snake_blocks is a “slice”, and this specific slice means “get all the snake blocks except the last one”.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |