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 &quot;*&quot;+ lines + &quot;*&quot; + lines + &quot;*&quot; ## Testings: ## window(0): print &quot;Test 1&quot; print &quot;Expect to see: &quot; print &quot;***&quot; print &quot;***&quot; print &quot;***&quot; print &quot;Actual output follows: &quot; window(0) ## window(1): print &quot;Test 2&quot; print &quot;Expect to see: &quot; print &quot;*-*-*&quot; print &quot;| | |&quot; print &quot;*-*-*&quot; print &quot;| | |&quot; print &quot;*-*-*&quot; print &quot;Actual output follows&quot; window(1) ## window(3): print &quot;Test 3&quot; print &quot;Expect to see: &quot; print &quot;*---*---*&quot; print &quot;| | |&quot; print &quot;| | |&quot; print &quot;| | |&quot; print &quot;*---*---*&quot; print &quot;| | |&quot; print &quot;| | |&quot; print &quot;| | |&quot; print &quot;*---*---*&quot; print &quot;Actual output follows&quot; window(3)...
View Full Document

Page1 / 2

a8q1 - c += 1 print &amp;amp;quot;*&amp;amp;quot;+ 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