I keep getting an error that’s referencing one of my Dictionaries in the code. But I can’t seem to find anything that would be causing the problem. Something is probably slipping past my eyes, but here’s the error from command line pdb anyways.
To explain what’s going on, this is a rather large dictionary and it’s telling me this is giving the program a ‘Syntax Error: Invalid Syntax’. The arrow doesn’t make much sense in telling me what…. Keynote again this is the result from pdb.
distinctiveFeatures = ({1:'Beak',2:'Blood-Drenched',3:'Boiling or Steaming B
ody',4:'Constantly Shedding',5:'Distinctive Markings',6:'Elongated Neck',7:'Hood
',8:'Expanded bone Structure',9:'Albino',10:'Eye Stalks',11:'Glowing Eyes',12:'H
air',13:'Horns',14:'Lizard-Like Fin',15:'Fish-Like Fin',16:'Icy or Cold Body',17
:'Illusionary Features',18:'Metal-Like Features',19:'Multiple Arms',20:'Multiple
Heads',21:'Antlers',22:'Multiple Legs',23:'Multiple Eyes',24:'Stinger',25:'Odor
',26:'On Fire',27:'Oozing Sores',28:'Plant Features',29:'Prehensile Tongue',30:'
Pulsating Skin',31:'Faces',32:'Rocklike Features',33:'Rubber boned',34:'Rubbery
Body',35:'Scales',36:'Serpent Appendages',37:'Shade Form',38:'Shambling Gait',39
:'Shell',40:'Shimmering Body',41:'Skeletal Appearance',42:'Slimy',43:'Speech',44
:'Suction Cups on Limbs',45:'Tail',46:'Tentacles',47:'Transparent',48:'Unusual C
olor',49:'Weapons for Hands',50:'Wet or Drenched Body'51:'Wings',52:'Mechanical
Features',53:'Multiple Features',54:'Special'})
^
By the way, why do you put the dictionary between brackets?
You can do
({ ..},)to make the dictionary the first element of a tuple,or just
{..}for a plain dictionaryUsing an editor that shows syntax coloring (like e.g. Idle or SciTe) helps a lot.
Because your keys are all integers, perhaps an easier option would be to make a list:
to get your element:
gives