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


Groups > comp.lang.python > #34708

Re: Hollow square program

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '(at': 0.03; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rows': 0.09; 'columns': 0.16; 'hollow': 0.16; 'received:80.91.229.3': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-dialin.net': 0.16; 'row': 0.16; 'subject:program': 0.16; 'wrote:': 0.17; 'input': 0.18; 'thus': 0.24; 'least': 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.28; 'aligned': 0.29; 'prints': 0.29; 'code': 0.31; '(and': 0.32; "aren't": 0.33; 'to:addr:python-list': 0.33; 'minimum': 0.34; 'thanks': 0.34; 'too.': 0.35; 'add': 0.36; 'received:org': 0.36; 'but': 0.36; 'two': 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; 'your': 0.60; 'first': 0.61; 'between': 0.63; 'email addr:gmail.com': 0.63; 'square': 0.75; 'square,': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: Hollow square program
Date Wed, 12 Dec 2012 18:44:21 +0100
Organization None
References <1aa414f0-1e4c-424b-abc6-8e681631788b@googlegroups.com> <mailman.779.1355331602.29569.python-list@python.org> <1ab10bb2-9036-414b-af24-0a3d2d32c9d2@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p5084abfa.dip.t-dialin.net
User-Agent KNode/4.7.3
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.785.1355334206.29569.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1355334206 news.xs4all.nl 6950 [2001:888:2000:d::a6]:43433
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:34708

Show key headers only | View raw


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 first and last row have an extra space between the asterisks. For the 
square to look like a square you need to add these to the other rows (and 
thus s2), too.

Also note that your code prints a minimum of two rows.

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