Last active
September 29, 2021 18:33
-
-
Save fmalina/1dae9e53581cf8053e3a35bbf236f93b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Create acronyms for names following rules | |
test using: python acronym_maker.py -v | |
""" | |
def acronym_maker(s): | |
""" | |
Make up 2 and 3 letter acronyms for given string | |
WIP: The following tests are not passing | |
2-letter short, 3-letter short, full name | |
72 '72 1972 | |
75 '75 1975 | |
32 P32 PO32 | |
30 P30 PO30 | |
AC ACT A Cherry On Top | |
AM AMK ADA Meze Kitchen | |
AC ALC Alan's Cakes | |
AL ALC Albany Lodge Catering Franchise - Newport Masonic Club | |
AP ALP Antoine's Little Pudding Parlour | |
BQ B&Q Cafe | |
BP BEP Bengal Palace | |
BR BUR Burrs Restaurant | |
CS CAS Caffe-Society | |
CC CCR Cake Creations By Roz | |
CG CAG Cakes Ga-lor | |
CW CSM Calbourne Water Mill | |
CC CAC Carisbrooke Castle | |
CG CGC Chillerton\& Gatcombe Community Association (Village Hall) | |
CH CHT Coach House Tea Rooms At Carisbrooke Castle | |
DM DUM Dunelm Mill | |
EI EIW Equals Isle Of Wight | |
EF EUF Eurest Foodservice | |
FP FLP Flour Power | |
FV FVN Forest View Nursey | |
FF FRF French Franks | |
""" | |
acronym = ''.join([x[0] for x in s.split()])[:2] | |
return acronym | |
if __name__ == "__main__": | |
import doctest | |
doctest.testmod() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment