#! /usr/bin/python3 import sys def main(): # we can start our dictionary with a few items ... d = {'cat':'chat', 'kitchen':'cuisine', 'computer':'ordinateur'} # ... and add a few more... d['cool'] = 'cool' d['boredom'] = 'ennui' d['end'] = 'fin' # check if one word was given to translate if len(sys.argv) != 2: print('Correct usage: Eng2FrDict English-word\n') # check if given word is in the dictionary elif sys.argv[1] not in d: print('Cannot translate %s' % sys.argv[1]) # OK, translate else: print(d[sys.argv[1]]) main()