Saravji's Hut

Logo

The place where change happens.

Project on GitHub Saravji/saravjis_hut

Saravji's Hut YouTube channel

Saravji on Twitter

Foundations of Programming (Python)

LAB 08-A: Working with Classes:

In this Lab, we will work with classes.
The task / data we use: Create a class to hold information about music tracks / songs on a CD / music album. (position, title, length)

  1. Create a class file, save it as Lab08_A.py in the Mod_08 folder.
  2. Add code to create a class TrackInfo.
  3. Add code to create fields for position, title, length with data types int, string, string, respectively.
  4. Test the class and make sure it works.

One note about testing: Make sure to test that the script works as expected (with ‘good’ values).
But also think about what values to use to test that you can’t break your script.
These tests typically are more efficient.

Back to Modules Materials Lists