Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'permitted': 0.07; "'')": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrote': 0.14; '2):': 0.16; 'loops': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'tool.': 0.16; 'pieces': 0.19; 'print': 0.22; 'first,': 0.26; 'second': 0.26; 'header:X -Complaints-To:1': 0.27; 'function': 0.29; 'could': 0.34; 'case,': 0.35; 'so,': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'solve': 0.60; 'length': 0.61; 'first': 0.61; 'email addr:gmail.com': 0.63 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: Boxes of O's Date: Sat, 1 Mar 2014 22:04:13 -0500 (EST) Organization: news.gmane.org References: <31bde8f6-25a6-484f-af6b-bbef7f7a0fdf@googlegroups.com> X-Gmane-NNTP-Posting-Host: dpc6744192186.direcpc.com X-Newsreader: PiaoHong Usenet NewsReaders 1.36 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393729214 news.xs4all.nl 2887 [2001:888:2000:d::a6]:40874 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67406 geniusrko@gmail.com Wrote in message: > Well, This is what i got > > n = int(input("enter number of o: ")) > > for i in range(n): > print("O", end = '') > for j in range(n* 2): > print("O", end = '') > > print() > Are you permitted to write and call functions? If so, then write functions to solve pieces of the problem, and call those functions from your main one. That's called factoring, and is an important tool. In this case, one function could print a row of 'o' of length siz, while the second one print a 'hollow' row. Then your main calls first, then loops calling hollow, then calls first again. -- DaveA