a6q5 - ## Testings: ## window(0): print "Test...

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

View Full Document Right Arrow Icon
## CS 116 Assignment 6 Question 5 ## Ru Wang r46wang 20319247 ## window: integer[non-negative] -> void ## purpose: this functio 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): print "*" + "-"*n + "*" + "-"*n + "*" x = n while x>0: print "|" + " "*n + "|" + " "*n + "|" x = x - 1 print "*" + "-"*n + "*" + "-"*n + "*" y = n while y>0: print "|" + " "*n + "|" + " "*n + "|" y = y - 1 print "*" + "-"*n + "*" + "-"*n + "*"
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: ## 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

Page1 / 2

a6q5 - ## Testings: ## window(0): print "Test...

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