The input and output is as wanted, but why error?

geezle86 at gmail.com geezle86 at gmail.com
Tue Dec 3 17:36:31 CET 2013


> x = input() 
> 
> if x.isdigit() == False: 
>     i = len(x) 
>     j = i - 1 
>     k = i - 2 
> 
>     xList = list(x) 
> 
>     if len(xList) > 4: 
>         print(xList[0], int(k), xList[j], sep='', end='') 
>     else: 
>         print(x) 
> else: 
>     SystemExit 

I just dont understand what is wrong, seriously. I mean. They said: 

"..if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation." 

and: 
"... 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 zeroes." 

I solved it with my: 

xList = list(x) 

    if len(xList) > 10: #I changed it from 4, still not accepted
        print(xList[0], int(k), xList[j], sep='', end='') 
    else: 
        print(x) 

really, i dont know why.. :(



More information about the Python-list mailing list