Генератор аббревиатур

  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. from random import choice
  4.  
  5. d={'A':['Apple', 'Amsterdam', 'Actor'], 'B':['Barebone', 'Book', 'Best'], 'C':['Computer', 'Course', 'Cisco'], 'D':['Data', 'Document', 'Dog'],
  6.    'E':['Eagle', 'Egg', 'Elephant'], 'F':['Fire', 'Focus', 'Flying'], 'G':['Guide', 'Good', 'Glass'], 'H':['Hewlett', 'Hand', 'Hourse'],
  7.    'I':['Idle', 'In', 'It'], 'J':['Joke', 'January', 'Jeans'], 'K':['Kit', 'Knife', 'Knowledge'], 'L':['Like', 'Looking', 'Less'],
  8.    'M':['Motherboard', 'Macintosh', 'Map'], 'N':['Network', 'Nice', 'Nuckle'], 'O':['Orby', 'Out', 'Or'], 'P':['Packard', 'Protocol', 'Pig'],
  9.    'Q':['Quota', 'Quick', 'Quit'], 'R':['Red', 'Rock', 'Rose'], 'S':['Shine', 'Show', 'Shock'], 'T':['Terminal', 'Transformer', 'Tour'],
  10.    'U':['University', 'Universal', 'Unicode'], 'V':['View', 'Vapid', 'Vat'], 'W':['Weather', 'Wine', 'Warshark'], 'X':['Xeon', 'Xtreme', 'Xylophone'],
  11.    'Y':['Yellow', 'Yawn', 'Year'], 'Z':['Zoom', 'Zeal', 'Zoopark']}
  12. print "Введите Аббревиатуру"
  13.  
  14. a=raw_input()
  15. b=a.upper()
  16.  
  17. result = ''
  18. for letter in b:
  19.     result += ' '+choice(d[letter])
  20.  
  21. print "Query: %s" % a
  22. print "Result: %s" % result

Реклама

Мы в соцсетях

tw tg yt gt