Pro-tip #1: Instead of having to re-type initialize("/dev/tty.Fluke2-XXXX-Fluke2") every time you have to re-launch Calico, put this command in a function in the Python script that you are working on. That way, after you load (open) and run the script, you'll have a quick way of re-connecting to the Fluke. So your script will start with:
from Myro import * def connect(): initialize("/dev/tty.Fluke2-XXXX-Fluke2") # XXXX is your Fluke's IDPro-tip #2: I probably don't need to say this again, but when the author says Start Calico, enter the program, and run it, you should interpret this as Start Calico, copy-and-paste the program into a new script, and run it. If the indentation (tabs) fail to paste in, you can quickly add them by hand (or by selecting the code and doing Edit/Indent Region); however, starting with this lab, I will take off 5% from your lab grade each time I see you typing something in by hand that you could have copied and pasted.
Once you've read through the top of page 42 on arithmetic in Python, try the following experiment: launch a terminal window (from the menu via Go/Utilities/Terminal or from the icon in the dock at the bottom of the screen). In the terminal type python and the return key to launch the Python command-interpreter. Note down the version number that you see. Then try some of the division computations at the top of the page: 10/3 and 1/2. Note down the results. Then try putting a decimal place into one of the numbers: 10/3. and 1/2. Now quit out of Python by typing CTRL-D (control and d keys at the same time). Launch python again, this time by typing python3. Again, note down the version number and try the divisions with and witout the decimal point.
Question 3.1. What was the difference between the two versions of Python that you ran in the terminal? Which version agreed with what you get in Calico? Which version makes more sense to you? Can you imagine a kind of error (perhaps something very bad) that could result from the way the earlier version performs division? As usual, a simple illustrative example is better than a long-winded explanation.
Once you've read through the top of page 45, quit Calico, re-launch it, copy-and-paste the second version of worldPop.py as a new script, and try to run the script.
Question 3.2. What error did you get when you tried to run the second version of worldPop.py ? Where do you think the missing “global name;” might be defined? (Think of how we gained access to commands like initialize and forward.) Fix the new worldPop.py by adding the relevant line of code at the top (below the header comments), then try out the code again.
Once you're done reading through the top of page 55, you should have two modified programs to turn in: worldPop.py and dance.py. You can then begin the exercises. When the author asks you to write a Python program, come up with a reasonable name for that program (like cels2fahr.py for the Celsius-to-Farhenheit program), write and test the program, and add it to the list of programs that you'll turn in to me at the end. When the author asks you to try something out and answer question (as in Exercise 5), add your answer to your writeup.