944,159 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 419
  • Python RSS
Nov 7th, 2009
0

Rectangles in functions?

Expand Post »
hi basically i have to write a function which draws 4 rectangles next to eachother(consisting of spcaes then hashes then spaces then finally hashes, all of the same height). the rectangles final The rectangles common height,and the width of the four rectangles should be parameters, e.g.(3, 0, 5, 4, 2) will output.

##### ##
##### ##
##### ##

heres my current code. the drawBlockC function is the second part of the answer.

def drawBlock(height, width):
for i in range( height ):
print width * "# "

def drawLetterC():
drawBlock(1, 7)
drawBlock(1, 7)
drawBlock(1, 2)
drawBlock(1, 2)
drawBlock(1, 7)
drawBlock(1, 7)
Similar Threads
Reputation Points: 10
Solved Threads: 2
Light Poster
jaison2 is offline Offline
33 posts
since Nov 2009
Nov 8th, 2009
0
Re: Rectangles in functions?
hi,
I didn't quite understand the specification of the function that you want to write. Especially this part

Quote ...
the rectangles final The rectangles common height,and the width of the four rectangles should be parameters, e.g.(3, 0, 5, 4, 2) will output.

##### ##
##### ##
##### ##
Do you need only the width and height of the rectangles or is there something else as well, because you say you need 4 rectangles but the output has only 2

P.S. sorry if i missed something in the spec.
Last edited by masterofpuppets; Nov 8th, 2009 at 10:04 am.
Reputation Points: 20
Solved Threads: 74
Posting Whiz in Training
masterofpuppets is offline Offline
272 posts
since Jul 2009
Nov 8th, 2009
0
Re: Rectangles in functions?
hi,
I didn't quite understand the specification of the function that you want to write. Especially this part



Do you need only the width and height of the rectangles or is there something else as well, because you say you need 4 rectangles but the output has only 2

P.S. sorry if i missed something in the spec.
This is just an example... we just need to create a function which can draw upto 4 rectangles.. even i dnt relly get this question thts y i am looking for help..lol
Reputation Points: 10
Solved Threads: 2
Light Poster
jaison2 is offline Offline
33 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Using Python help inside Eclipse?
Next Thread in Python Forum Timeline: Alarm Question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC