Python Programming for Raspberry Pi, Sams Teach Yourself in 24 Hours

(singke) #1
are creating the Birds base class object file that is needed for the Python script.

By the Way: Continue to Make It Easy
Instead of doing all this typing, you can download all three files—birds.py,
barnswallow.py, and sacliffswallow.py—from informit.com/register.
After downloading these object module files, you can skip over the steps to create
them!


  1. Make sure you have entered the statements into the nano text editor window, as shown in
    Listing 15.4. Make any corrections needed.

  2. Write out the information from the text editor to the file by pressing Ctrl+O. The file name
    shows along with the prompt File name to write. Press Enter to write out the
    contents to the birds.py object file.

  3. Exit the nano text editor by pressing Ctrl+X.

  4. At the command-line prompt, type nano py3prog/barnswallow.py and press Enter.
    The command puts you into the nano text editor and creates the file py3prog/barnswallow.py.

  5. Type all the information from barnswallow.py in Listing 15.5 into the nano editor
    window. You are creating the BarnSwallow subclass object file that is needed for the
    Python script.

  6. Make sure you have entered the statements into the nano text editor window, as shown in
    Listing 15.5. Make any corrections needed.

  7. Write out the information from the text editor to the file by pressing Ctrl+O. The file name
    shows along with the prompt File name to write. Press Enter to write out the
    contents to the barnswallow.py object file.

  8. Exit the nano text editor by pressing Ctrl+X.

  9. Hang in there! You are getting close! At the command-line prompt, type nano
    py3prog/sacliffswallow.py and press Enter. The command puts you into the nano
    text editor and creates the file py3prog/sacliffswallow.py.

  10. In the nano text editor window, type the information from lines 17–29 in the birds.py file
    in Listing 15.3 (the comment lines).

  11. Now type the following into the nano editor window:


Click here to view code image


from birds import Bird #import Bird base class


  1. Finish the SouthAfricaCliffSwallow subclass object file that needed for the Python
    script by typing in the Python statements from lines 20 through 41 in Listing 15.3.

  2. Make sure you have entered the statements into the nano text editor window as shown in
    Listing 15.3, along with the additional import statement. Make any corrections needed.

  3. Write out the information from the text editor to the file by pressing Ctrl+O. The file name
    shows along with the prompt File name to write. Press Enter to write out the
    contents to the sacliffswallow.py object file.

Free download pdf