dimanche 31 juillet 2016

Trying to assign values to keys in dictionary gives type error

dict["north-west"]=(south+width_NS,west) TypeError: 'type' object does not support item assignment class Building: def __init__(self, south, west, width_WE, width_NS, height=10): keys=("north-west","north-east","south-west","south-east") dict.fromkeys(keys) dict['north-west']=(south+width_NS,west) dict["north-east"]=(south+width_NS,west+width_WE) dict["south-west"]=(south,west) dict["south-east"]=(south,west+width_WE) self.corners=dict

Aucun commentaire:

Enregistrer un commentaire