import random import time print (' Drug Dosing Test! ') time.sleep(2) print ' Instructions: This test will test on the RANGES of different drugs' print ' Example: For the question: " What is the drug dosing of Simvastatin ?" ' time.sleep(2) print ' (*****Your answer will be " 5-80 "******* ' time.sleep(4) print ("let's begin!") time.sleep(2) dosages = {"Simvastatin":"5-80","Gabapentin":"100-400","Duloxetine":"10-60","Lorazepam":".5-2",\ "Albuterol Sulfate(mcg per actuation?)":"90", "Levothyroxine Sodium": "25-300", "Lisinopril":"2.5-40",\ "Omeprazole": "10-40", "Amlodipine Besylate": "2.5-10", "Metformin Hydrochloride": "500-1000", "Metoprolol Tartrate": "25-100", "Furosemide": "20-80",\ "Atorvastatin": "10-80", "Alprazolam": ".25-3", "Tramadol Hydrochloride": "100-300", "Potassium Chloride": "750-1500", "Citalopram Hydrobromide": "10-40",\ "Warfarin Sodium": "1-10", "Azithromycin Dihydrate": "250-600", "Metoprolol Succinate": "50-200", "Zolpidem Tartrate": "5-10", "Hydrocholorothiazide": "25-50",\ "Amoxicillin Trihydrate": "125-875", "Prednisone": "1-50", "Meloxicam" : "7.5-15", "Sertraline Hydrochloride": "25-100", "Montelukast Sodium": "10", "Carvedilol": "3.25-80",\ "Clonazepam": ".25-2", "Cyclobenzaprine Hydrochloride": "5-15", "Losartan Potassium": "25-100", "Pantoprazole" : "20-40", "Clopidogrel Bisulfate": "75-300", "Trazodone Hydrochloride" : "50-300",\ "Pravastatin Sodium": "10-80", "Fluoxetine HCl": "10-40", "Lorazepam": ".5-2", "Ranitidine Hydrochloride": "150-300", "Venlafaxine Hydrochloride": "25-150", "Tamsulosin Hydrochloride": ".4"} wrong=[] incorrect_answers = False while len(dosages) > 0: pick = random.choice(list(dosages.keys())) correct_answer = dosages.get(pick) print "What is the drug dosing range of", pick ,"?" answer = raw_input("Your answer: ") if answer.lower()==correct_answer.lower(): print ("Correct!") del dosages[pick] else: print ("That's Incorrect :( ... ") print "The correct answer is", correct_answer wrong.append(pick) del dosages[pick] incorrect_answers = True print "You missed", len(wrong), "drugs" if incorrect_answers: print ("Here are the ones you may want to brush up on:\n") for each in wrong: print (each) else: print ('Perfect!')
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question