| | |
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 Nov 8th, 2009
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; Nov 8th, 2009 at 10:04 am.
•
•
Join Date: Nov 2009
Posts: 33
Reputation:
Solved Threads: 1
0
#3 Nov 8th, 2009
•
•
•
•
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
Views: 205 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Python
accessdenied address ansi backend beginner changecolor class code conversion coordinates copy curves customdialog dan08 dictionary directory dynamic edit examples excel feet file float font format ftp function generator getvalue gui halp homework i/o images import info input ip java line linux list lists loop mouse mysql newb number numbers output panel parsing path port prime print program programming projects py2exe pygame pyqt python queue random rational recursion recursive schedule screensaverloopinactive scrolledtext searchingfile server ssh stamp statictext string strings sudokusolver table terminal text thread threading time tkinter tlapse tuple tutorial type ubuntu unicode url urllib urllib2 variable whileloop windows write wxpython





