CSci 227 Syllabus    Resources    Coursework



Laboratory Exercise 5
CSci 227: Programming Methods
Department of Computer Science
Hunter College, City University of New York
Spring 2024

Learning Objectives:

Software Tools Needed: Web browser to access textbook and an IDE (on-line or on computer) with core Python 3.6+ loaded.

Lab Notes: Download the outline and focus questions to guide you while working through this lab. These are a useful tool for note taking and as well as studying for the quizzes and final exam.


Writing Classes

For most of the programming we have done so far, we have focused on procedural (or imperative) programming that is built around the idea that programs are sequences of instructions to be executed. Object-oriented programming changes the focus to be on objects which incorporate both data and functions into a single unit. Classes are the ``templates'' that specify what is included in each object.

The CSCI 127 textbook has an excellent overview of writing and using classes. We started it in lecture, and for the lab, you should work through the 2 chapters:



Using Standard Libraries

In CSCI 127, we introduced the numpy and pandas library for numerical and data analysis. This section contains brief overviews of numpy and pandas, as well as two other popular libraries: plotly for visualizing data and scipy which is an open source Python library used for scientific computing and technical computing (and includes many other libraries such as numpy).

Work through the surveys of each:


Quizzes and Code Reviews

There are weekly written quizzes and code reviews in 1001G, 11:30-5:30, Mondays-Fridays when classes are in session. No appointments are needed for CSCI 227 students. Make sure to complete Quiz 4 and Code Review 4 by Thursday, 14 March.

Additional Practice

For additional practice on core Python, see the HackerRank prepare series:

HackerRank: Prepare Python

Click the Easy option on the right hand menu, and work through their Python challenges.

For more practice on using recursion and classes to solve problems, here are some popular ones from LeetCode: