Advertisement
Ahmed-_-Taha

help.py

Oct 15th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. #!/usr/bin/python
  2. # Author Boumediene Kaddour ## you can put your name here :)
  3. # Date : 15/10/2014 22:24
  4. # helping people is a great thing
  5. database= {}
  6. choice = ''
  7. a ='''
  8. #################################
  9. \tHit CTRL+C to exit   
  10. #################################
  11.     '''
  12. print a
  13. dead = True
  14. while dead:
  15.    try:
  16.        
  17.     choice =raw_input("Add or look up a word:(a|l)")
  18.     if choice.lower() == 'a' or choice.lower() == 'add':
  19.         key = raw_input('Type the word:')
  20.         definition = raw_input('what is it: ')
  21.         database[key.capitalize()] = definition.capitalize()
  22.         print "Info has been added"
  23.     elif choice.lower() == 'l' or choice.lower() == 'lookup':
  24.         key = raw_input('Type the word: ')
  25.         print database[key.capitalize()]
  26.    
  27.     else:
  28.         print 'only a && add || l && lookup are allowed '
  29.    except KeyboardInterrupt :
  30.     dead = False
  31.     exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement