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: 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> <1ab10bb2-9036-414b-af24-0a3d2d32c9d2@googlegroups.com> From: Ian Kelly Date: Wed, 12 Dec 2012 10:35:19 -0700 Subject: Re: Hollow square program To: Python 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Wed, Dec 12, 2012 at 10:22 AM, 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.