Implementthefunctionabbreviatethattakesthenameofamonthasinputandreturnsitsthree-letterabbreviation.Infact,itshouldtakeanystringasinputandreturnitsfirstthreecharacters,ast...
Implement the function abbreviate that takes the name of a month as input and returns its three-letter abbreviation. In fact, it should take any string as input and return its first three characters, as these examples illustrate:
assert abbreviate('January') == 'Jan'
assert abbreviate('abril') == 'abr'
写一个程序,能够取一个单词的前三位缩写,能够适用于任何长度的单词。
展开