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


Groups > comp.lang.python > #34706

Re: Hollow square program

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; '(at': 0.03; 'rows': 0.09; 'dec': 0.15; 'columns': 0.16; 'hollow': 0.16; 'subject:program': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'input': 0.18; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'aligned': 0.29; 'spaces': 0.29; 'received:209.85.215.46': 0.30; "aren't": 0.33; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'but': 0.36; '12,': 0.36; 'characters': 0.36; 'enough': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'space': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'between': 0.63; 'account': 0.67; 'square,': 0.84; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=ZPzqjtshlDdGSa2kbyv0S04fFGAZcglKfTmgZwbCx4Q=; b=XwBU7p8esDvRQWKiPdzQrH6TDSC2sQaGOgOFsHPbqsNp4e6xv/nSoCwmUEL8odmZyU 3b5L17k4TK4NoH1wTcKu21P5gIpKBNq5isTZF0iDNB16evWW6NytpZ+NrNrrZ+M0TR2g 8U6jC8wF9BfbDibnEJp+oLMt4+MEhyt9NIKEBPjPPv5GcbwLfyDkYiWheT/ieHAiYp9m jBp7EC/glTLo32qllpOh7kt9z0xYz8UPWhfzot0fGbiH59ljBCqvQVCv2gRxIeyvvCGu iphHkmdVpIJ/DPZ+CgEJIVLh0KAtQyWc5/bvQpNlHr3IAiZ2t6PtH8oBZjfskcNRGUOn 6avA==
MIME-Version 1.0
In-Reply-To <1ab10bb2-9036-414b-af24-0a3d2d32c9d2@googlegroups.com>
References <1aa414f0-1e4c-424b-abc6-8e681631788b@googlegroups.com> <mailman.779.1355331602.29569.python-list@python.org> <1ab10bb2-9036-414b-af24-0a3d2d32c9d2@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Wed, 12 Dec 2012 10:35:19 -0700
Subject Re: Hollow square program
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.784.1355333752.29569.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1355333752 news.xs4all.nl 6982 [2001:888:2000:d::a6]:36998
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:34706

Show key headers only | View raw


On Wed, Dec 12, 2012 at 10:22 AM,  <siimnurges@gmail.com> wrote:
> Well, I did some modifications and got a hollow square, but the columns aren't perfectly aligned with the rows (at least if input is 5. Thanks for the help :)
>
> rows = int(input())
> s1="* "*rows
> s2="*"+(rows-2)*" "+"*"
> print(s1)
> for s in range(rows-2):
>     print(s2)
> print(s1)

The (rows-2)*" " in s2 is only enough spaces to account for the
(rows-2) inner * characters in s1.  You also need additional spaces in
s2 to match up with for the (rows-1) space characters in between the *
characters in s1.

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


Thread

Hollow square program siimnurges@gmail.com - 2012-12-12 08:48 -0800
  Re: Hollow square program Chris Angelico <rosuav@gmail.com> - 2012-12-13 03:59 +1100
    Re: Hollow square program siimnurges@gmail.com - 2012-12-12 09:22 -0800
      Re: Hollow square program Ian Kelly <ian.g.kelly@gmail.com> - 2012-12-12 10:35 -0700
      Re: Hollow square program Peter Otten <__peter__@web.de> - 2012-12-12 18:44 +0100
        Re: Hollow square program siimnurges@gmail.com - 2012-12-12 09:52 -0800
          Re: Hollow square program Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-12-12 23:47 +0000
            Re: Hollow square program Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-13 00:12 +0000
        Re: Hollow square program siimnurges@gmail.com - 2012-12-12 09:52 -0800
    Re: Hollow square program siimnurges@gmail.com - 2012-12-12 09:22 -0800
  Re: Hollow square program Mitya Sirenef <msirenef@lightbird.net> - 2012-12-12 12:18 -0500
    Re: Hollow square program siimnurges@gmail.com - 2012-12-12 09:25 -0800
    Re: Hollow square program siimnurges@gmail.com - 2012-12-12 09:25 -0800

csiph-web