Simple program storing notes

Using while, if, break, else of python (3.5).

Purpose: Make a check list of ATC/DDD index (First Level)

Each medicine (or drugs) has its ATC/DDD index, for example, A10AB01 is insulin’s ATC/DDD index (ref: The first letter of A10AB01 has its own meaning and also the numbers/letters following. How to check the information of these letters? Here it is.

First, make a dictionary named ATCCode. A dictionary is built with {}, =, ‘ ’, and ,.

ATCCode = {‘A’: ‘Alimentary tract&metabolism’,
 ‘B’: ‘Blood&blood forming organs’,
 ‘C’: ‘Cardiovascular sys.’,
 ‘D’: ‘Dematologicals’,
 ‘G’: ‘Genito-urinary sys&sex hormones’,
 ‘H’: ‘Systemic hormonal preparations, excluding sex hormones&insulins’,
 ‘J’: ‘Antiinfectives for systemic use’,
 ‘L’: ‘Antineoplastic&immunomodulating agents’,
 ‘M’: ‘Musculo-skeletal system’,
 ’N’: ‘Nervous system’,
 ‘P’: ‘Antiparasitic products, insecticides&repellents’,
 ‘R’: ‘Respiratory sys.’,
 ‘S’: ‘Sensory organs’,
 ‘V’: ‘Various’} # Create a dictionary to store data.

Then, make a loop with while, if and else, and don’t forget break.

while True:
print(‘\nEnter first alphabeta of ATC code:\n(blank to quit)’)
alpha = input()
if alpha == ‘’:
if alpha in ATCCode: # The keyword ‘in’ is a key
print(ATCCode[alpha] + ‘ belongs to ‘ + alpha)

# If the alpha is in the dictionary, you access the associated value using square brackets.
print(‘I do not have ATCCode informtion for ‘ + alpha)
print(‘What is their information?’)
ATCCodeInformation = input()
ATCCode[alpha] = ATCCodeInformation
print(‘ATCCode database updated.’)

#This program can be modified for storing ID and passwords.

A single golf clap? Or a long standing ovation?

By clapping more or less, you can signal to us which stories really stand out.