In this lab, we’ll work through some problems that emphasize while-loops and expressions.
Create a new program called box.py .
This program will print out a box that is 5 characters wide, and N characters tall (where N is a input value chosen by the user).
The user should also be able to specify the character that the box will be made out of.
Do not use any string multiplication!
Below are two example runs, to give you an idea of the ideal behavior:
|
Create a file named box-2.py , and copy your code over from box.py .
Change it so that the box can be made out of two types of characters.
The box will be printed out with these two characters on every-other line.
For example:
|
Create a file named box-3.py , and copy your code over from box-2.py .
Change it so that the box width can also be specified.
Again, do NOT use any string multiplication.
You might need to put a while-loop inside of another while-loop.
For example:
|
Write a new program named tree.py .
this problem is basically the same one that we started working on at the end of class on Monday.
This program will print out trees of a custom body height and trunk height (which will both be user inputs).
so that the box width can also be specified.
Again, do NOT use any string multiplication.
You might need to put a while-loop inside of another while-loop.
For example, a body height of 7 and a trunk height of 1 will produce:
|
You must turn in at least 2 of the 4 problems on D2L to get credit for this.