Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60945

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

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:error': 0.03; 'else:': 0.03; 'output': 0.05; 'problem:': 0.07; 'len(x)': 0.09; 'lines.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'thus,': 0.09; 'false:': 0.16; 'lengths': 0.16; 'letters.': 0.16; 'lowercase': 0.16; 'outputs': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'systemexit': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'replacing': 0.19; 'work,': 0.20; '8bit%:5': 0.22; 'input': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'integer': 0.24; 'possess': 0.24; 'source': 0.25; 'long,': 0.26; 'purposes': 0.26; 'suggested': 0.26; 'this:': 0.26; 'post': 0.26; 'skip:" 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'words': 0.29; "doesn't": 0.30; 'code': 0.31; 'lines': 0.31; 'decimal': 0.31; 'supposed': 0.32; 'quite': 0.32; 'text': 0.33; 'message.': 0.35; 'problem': 0.35; 'no,': 0.35; 'but': 0.35; 'consist': 0.36; 'subject:?': 0.36; 'should': 0.36; 'changing': 0.37; 'too': 0.37; 'project': 0.37; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'letters': 0.60; 'solve': 0.60; 'length': 0.61; 'strictly': 0.61; 'first': 0.61; 'times': 0.62; 'email addr:gmail.com': 0.63; 'subject:The': 0.64; 'more': 0.64; 'here': 0.66; 'between': 0.67; 'url:a': 0.72; 'special': 0.74; '100': 0.79; 'fail.': 0.84; 'undergo': 0.84; 'wanted,': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Neil Cerutti <neilc@norwich.edu>
Subject Re: The input and output is as wanted, but why error?
Date Tue, 3 Dec 2013 16:10:40 +0000 (UTC)
Organization Norwich University
References <387f5b5f-faf1-4715-8d49-e366be53fd00@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jackman.norwich.edu
User-Agent slrn/0.9.9p1/mm/ao (Win32)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3518.1386087064.18130.python-list@python.org> (permalink)
Lines 71
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386087064 news.xs4all.nl 2877 [2001:888:2000:d::a6]:57169
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60945

Show key headers only | View raw


On 2013-12-03, geezle86@gmail.com <geezle86@gmail.com> wrote:
> I am trying to solve this problem:
>
> http://codeforces.com/problemset/problem/71/A

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
> zeroes.
> 
> 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.
> 
> Input
> 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.
> 
> Output
> 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[0], int(k), xList[j], sep='', end='')
>     else:
>         print(x)
> else:
>     SystemExit
>
> 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?

-- 
Neil Cerutti

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

The input and output is as wanted, but why error? geezle86@gmail.com - 2013-12-03 07:48 -0800
  Re: The input and output is as wanted, but why error? John Gordon <gordon@panix.com> - 2013-12-03 16:03 +0000
  Re: The input and output is as wanted, but why error? Neil Cerutti <neilc@norwich.edu> - 2013-12-03 16:10 +0000
  Re: The input and output is as wanted, but why error? geezle86@gmail.com - 2013-12-03 08:35 -0800
    Re: The input and output is as wanted, but why error? Dave Angel <davea@davea.name> - 2013-12-03 12:58 -0500
    Re: The input and output is as wanted, but why error? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-12-03 17:54 -0500
  Re: The input and output is as wanted, but why error? geezle86@gmail.com - 2013-12-03 08:36 -0800
    Re: The input and output is as wanted, but why error? Neil Cerutti <neilc@norwich.edu> - 2013-12-03 16:58 +0000
  Re: The input and output is as wanted, but why error? geezle86@gmail.com - 2013-12-03 08:38 -0800
    Re: The input and output is as wanted, but why error? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-03 16:51 +0000
  Re: The input and output is as wanted, but why error? rusi <rustompmody@gmail.com> - 2013-12-03 09:19 -0800
  Re: The input and output is as wanted, but why error? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-03 23:52 +0000

csiph-web