Skip to content

Week 9, Projects 2, Part A, 9A1 Quiz Bug? #153

@Enturk

Description

@Enturk

From Brandon Trainor, who reported a couple of other bugs:

If I am properly reading the choose_ghosts_spots function, it:
• Consumes the grid list and the number of ghosts to spawn
• Uses len() to obtain a int representing the length and width of grid (which it gets away with because it's assumed all grids passed into the function are perfectly square)
• Uses that to create a set of shuffled range lists for the x and y pairs
• Takes those randomly ordered x and y lists and pops the last value from each one to append an [x, y] list to the positions list
• repeats the last step for the number of ghosts consumed at the beginning
• returns the newly created positions list
Image

Looking at the quiz question, it states that in order for the function to be considered mutable, it had to modify the actual grid list that the function consumes:
Image

To me, it seems that passing the grid into the function only serves to grab the immutable value of its length, not to modify grid itself in any way, meaning that the choose_ghost_spots function should actually be considered immutable, correct?

I'm not sure if this is a bug, because I haven't double checked it, but I didn't want to lose track of it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions