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


Groups > comp.lang.python > #67406

Re: Boxes of O's

From Dave Angel <davea@davea.name>
Subject Re: Boxes of O's
Date 2014-03-01 22:04 -0500
Organization news.gmane.org
References <c753ba44-379b-4322-96c0-4ba5cb8fa7c1@googlegroups.com> <mailman.7529.1393701408.18130.python-list@python.org> <31bde8f6-25a6-484f-af6b-bbef7f7a0fdf@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.7559.1393729214.18130.python-list@python.org> (permalink)

Show all headers | View raw


 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

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


Thread

Boxes of O's geniusrko@gmail.com - 2014-03-01 11:12 -0800
  Re: Boxes of O's Chris Angelico <rosuav@gmail.com> - 2014-03-02 06:16 +1100
    Re: Boxes of O's geniusrko@gmail.com - 2014-03-01 11:28 -0800
      Re: Boxes of O's MRAB <python@mrabarnett.plus.com> - 2014-03-01 19:41 +0000
      Re: Boxes of O's Chris Angelico <rosuav@gmail.com> - 2014-03-02 06:54 +1100
        Re: Boxes of O's geniusrko@gmail.com - 2014-03-02 06:43 -0800
          Re: Boxes of O's Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-02 14:56 +0000
          Re: Boxes of O's Glazner <yoavglazner@gmail.com> - 2014-03-02 13:30 -0800
          Re: Boxes of O's Michael Torrie <torriem@gmail.com> - 2014-03-02 14:48 -0700
      Re: Boxes of O's Dave Angel <davea@davea.name> - 2014-03-01 22:04 -0500

csiph-web