The input and output is as wanted, but why error?
neilc at norwich.edu
Tue Dec 3 17:10:40 CET 2013
On 2013-12-03, geezle86 at gmail.com <geezle86 at gmail.com> wrote:
> I am trying to solve this problem:
Please post your code in and the problem in your message. Here it
is for those reading along:
> A. Way Too Long Words
> Sometimes some words like "localization" or
> "internationalization" are so long that writing them many times
> in one text is quite tiresome.
> Let's consider a word too long, if its length is strictly more
> than 10 characters. All too long words should be replaced with
> a special abbreviation.
> This abbreviation is made like this: we write down the first
> and the last letter of a word and between them we write the
> number of letters between the first and the last letters. That
> number is in decimal system and doesn't contain any leading
> Thus, "localization" will be spelt as "l10n", and
> "internationalization» will be spelt as "i18n".
This is a ridiculous abbreviation scheme, but for purposes of
your project that doesn't matter.
> You are suggested to automatize the process of changing the
> words with abbreviations. At that all too long words should be
> replaced by the abbreviation and the words that are not too
> long should not undergo any changes.
> The first line contains an integer n (1?=?n?=?100). Each of the
> following n lines contains one word. All the words consist of
> lowercase Latin letters and possess the lengths of from 1 to
> 100 characters.
> Print n lines. The i-th line should contain the result of
> replacing of the i-th word from the input data
Here's your solution so far:
> x = input()
> if x.isdigit() == False:
> i = len(x)
> j = i - 1
> k = i - 2
> xList = list(x)
> if len(xList) > 4:
> print(xList, int(k), xList[j], sep='', end='')
> The input and output is as wanted, but my answer keep rejected,
> here is my source code http://txt.do/1smv
No, your program outputs nothing. That's bound to fail. ;)
How is your program supposed to work, in your own words?
More information about the Python-list