a8q1 - c = 1 print"" lines""...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
## CS 116 Assignment 8 Question 1 ## Ru Wang r46wang 20319247 ## window: integer[non-negative] -> none ## purpose: this function consumes an non negative integer and produces nothing ## Effects: it draws a window with 4 panes with the size determined by the integer entered. ## Examples: ## window(0) => ## *** ## *** ## *** ## window(1) => ## *-*-* ## | | | ## *-*-* ## | | | ## *-*-* def window(n): lines = "" spaces = "" a = 0 while (a < n): lines += "-" spaces += " " a += 1 print "*"+ lines + "*" + lines + "*" b = 0 while (b < n): print "|" + spaces + "|" + spaces + "|" b += 1 print "*"+ lines + "*" + lines + "*" c = 0 while (c < n): print "|" + spaces + "|" + spaces + "|"
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: c += 1 print "*"+ lines + "*" + lines + "*" ## Testings: ## window(0): print "Test 1" print "Expect to see: " print "***" print "***" print "***" print "Actual output follows: " window(0) ## window(1): print "Test 2" print "Expect to see: " print "*-*-*" print "| | |" print "*-*-*" print "| | |" print "*-*-*" print "Actual output follows" window(1) ## window(3): print "Test 3" print "Expect to see: " print "*---*---*" print "| | |" print "| | |" print "| | |" print "*---*---*" print "| | |" print "| | |" print "| | |" print "*---*---*" print "Actual output follows" window(3)...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 116 taught by Professor T.vasiga during the Fall '09 term at Waterloo.

Page1 / 2

a8q1 - c = 1 print"" lines""...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online