After the lab, you should be proficient at
As usual, create a directory for the programs and output you develop in this lab.
We'll practice writing several Python programs, each in their own text file. Name the files lab4.1.py through lab4.7.py.
Your programs will be graded on correctness, efficiency, style, and how well you tested them. Make sure you adhere to the good development and testing practices we discussed in class. Your code should be readable and your output should be useful and well-formatted.
After you've developed a correct solution to each program, close reopen the IDLE "shell" by running the program again (using F5), demonstrate that the program works using several good test cases, and save the output to a file named lab4.x.out, where x is the problem number.
not
and a pair of parentheses to reverse the behavior of your
program.Example Output:
This program draws a box. Enter width (2-80): 15 Enter height (2-20): 5 ............... . . . . . . ...............
for
loop, draw a diagonal line that looks
like:
\ \ \ \ \
Think about the pattern of what is getting printed. (Hint: a string operator may be useful.)
After you have that working, have the user enter the size of the diagonal line and draw a line of the appropriate size.
Enter the text: we love CS w we we we l we lo we lov we love we love we love C we love CS we love C we love we love we lov we lo we l we we w
Note that 1 m = .001 km = 1.094 yds = .0006215 mi
Calculate and display the results, formatted in the following manner:
Meters Kilometers Yards Miles --------------------------------------- 100 0.100 109.4 0.062 200 ----- ----- ----- 400 ----- ----- ----- 800 ----- ----- ----- 1600 ----- ----- -----
Note: Make sure your output looks exactly as above, but you will have all the converted values filled in.
turnin
directory.printLab.sh
command.View the file you just created using the gv
command to
ensure that you don't have any "junk" in the output.
Again, you should probably print from the labs
directory.
Print the file using the lpr
command introduced in the
first lab.
Labs are due at the end of lab. You should hand in the printed copy
at the beginning of class, and the electronic version should be in
the turnin
directory before the end of lab.