| | |
Rectangles in functions?
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2009
Posts: 33
Reputation:
Solved Threads: 1
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)
##### ##
##### ##
##### ##
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)
0
#2 24 Days Ago
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.
I didn't quite understand the specification of the function that you want to write.
Especially this part•
•
•
•
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.
##### ##
##### ##
##### ##

P.S. sorry if i missed something in the spec.
Last edited by masterofpuppets; 24 Days Ago at 10:04 am.
•
•
Join Date: Nov 2009
Posts: 33
Reputation:
Solved Threads: 1
0
#3 24 Days Ago
•
•
•
•
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.
![]() |
Similar Threads
- Tutorial: The real advantages of using functions correctly and to the maximum capability. (PHP)
- Collision Detection with rectangles (C++)
- C++ Functions. (C++)
- "Parallel" execution of functions (C++)
- Delegates and Functions (C#)
Other Threads in the Python Forum
- Previous Thread: Using Python help inside Eclipse?
- Next Thread: Alarm Question
| Thread Tools | Search this Thread |
alarm ansi assignment avogadro backend beginner binary bluetooth character cmd code customdialog cx-freeze data decimals dictionary directory drive dynamic error examples exe file float format function gnu graphics gui halp heads homework http ideas import input itunes java leftmouse line linux list lists logging loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule screensaverloopinactive script scrolledtext sqlite ssh statistics stdout string strings sudokusolver sum table terminal text thread threading time tlapse tricks tuple tutorial ubuntu unicode urllib urllib2 variable ventrilo verify webservice wikipedia write wxpython xlib





