0
def do_work():
  medications_subset2(b,['HYDROCODONE','MORPHINE','OXYCODONE'])

def medications_subset2(b,drugs_needed):
  MORPHINE=['ASTRAMORPH','AVINZA','CONTIN','DURAMORPH','INFUMORPH',
            'KADIAN','MS CONTIN','MSER','MSIR','ORAMORPH',
            'ORAMORPH SR','ROXANOL','ROXANOL 100']
  print drugs_needed[1][0]

how do i print ASTRAMORPH (this is the first element in MORPHINE)

i NEED to make use of drugs_needed, since this is being passed in from do_work

0

1 Answer 1

4

Can you define MORPHINE this way?

drugs = {
  'MORPHINE': ['ASTRAMORPH',...],
  'HYDROCODONE': [...],
  ...
}

then you can refer to it by

print ( drugs[drugs_needed[1]][0] )
Sign up to request clarification or add additional context in comments.

4 Comments

thank you very much. using this would how can iterate on all drugs in the morphine class?
@l: for drug in drugs[drugs_needed[1]]: ...
THANK YOU VERY MUCH GOOOOOOOOD SIR

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.