Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python 2.7 and Turtle I have 4 blocks that I need to arrange according to differ

ID: 3815358 • Letter: P

Question

Python 2.7 and Turtle

I have 4 blocks that I need to arrange according to different arrangment lists. One of the lists is as follows

arrangement_99 = [['Block C', 'Bottom left', 'Up'],
['Block D', 'Bottom right', 'Up'],
['Block A', 'Top left', 'Up'],
['Block B', 'Top right', 'Up']]

The 'Block D' etc refers to a corner of a 4 piece jigsaw puzzle drawing block (assume they have been drawn already). The 'Bottom right' etc refers to it's location on the jigsaw and the 'Up' etc refers to how the block is orientated)

We have to define a function called 'stack_blocks(arrangment_x)' which refers to the arrangement. I just have no idea on how to even start this.

I would like to use an absolute coordinate system for my blocks. Can anyone proivide any insight on how I should start this?

Explanation / Answer

if you want to test whether a particular block is present in any one of the arrangements you could first extract them all save it as a set and thenuse this set for testing

else simply you can get all the variables defined and then check if their valuecontains a list or not

arrangement_99=[['Block C', 'Bottom left', 'Up','O'],
['Block D', 'Bottom right', 'Up','O'],
['Block A', 'Top left', 'Up','O'],
['Block B', 'Top right', 'Up','X']]

def stack_blocks(arrangement_x):

for item in arrangement:

if 'Block C' in item:

print"its there"

for value in vars().values():

if instance(value,list):

stack _blocks(value);