CompSci 101, Fall 2014, Lab 2
Answer the following questions on the online google form for lab 2.
gravity.apt
- How many test cases pass when you run the gravity.apt when the
body is just "return 0.0"?
Farmer in the Dell
- Briefly describe the differences between the first three verses of the song?
- How could parameters be used to capture those differences (i.e., what value(s) might
X
and Y
represent when calling verse(X)
and verse(Y)
to generate the first and second verse, respectively)
?
Here We Go 'Round the Mulberry Bush
- Suppose you misspelled the word mend everywhere in your program to generate this song. How many times would that misspelling appear in the lyrics
? And how many places would you have to change it in your program?
- In class, we have seen that functions
return
values. In this lab, the functions just print
strings. What is the difference between the Python function print
and the Python operator return
?
Random Walk
- Final location of Bug in two random walk simulations?
- Names of functions in LabWalk?
- Line of code moving bug right? Why?
- Maximal number of times at origin in five runs.
- What happens when calls to plt.xxx are uncommented and program run?