GCTAA Logo

Governor's Career & Technical Academy Arlington

Introduction to Computer Science: Week 8


Overview

Monday we will see the presentations each pair made investigating the questions asked last week.

On Thursday we will apply what we learned and use TDD to begin creating a Python class to represent polynomials.

Friday, February 28th

Classwork

We won't have a quiz today, mainly because your teachers doesn't yet feel competent enough understanding regular expressions to be able to make a good one. Instead, we will use all of our class time and homework time to complete our investigation of regular expressions. Your evaluation for the week will include the regular expression experiments you did as part of your homework.

Our ToDo list:

  1. Finish remaining blocks of the (.*) Regular Expressions module in SoloLearn: More Metacharacters, Groups, Special Sequences, Email Extraction, and Module 8 Quiz.
  2. Apply what we learned to the problem of extracting coefficients and exponents from the terms of a polynomial.

Here is a short Python program that I found on stackoverflow:

import re


def get_coefficents(polynomial):
    regex = re.compile(r"(?:[+-]?\d*\.\d*|\+?(-?\d+))")
    return regex.findall(polynomial)


print(get_coefficients('2x^3+4x^2+8x-16'))

You should run this program and confirm that it returns: ['2', '3', '4', '2', '8', '-16']. More importantly, you should try to understand how it works!

Homework

Work with your partner to prepare a presentation on the following for class on Thursday:

Evaluation

Your evaluation for next week will be determined by the completeness and correctness of your presentation.

Wednesday, February 26th

Classwork

We will start with a short, Regular Expressions 1 quiz, and then use the rest of class time to work on our polynomials module.

Homework

Complete the next two blocks from the (.*) Regular Expressions module in SoloLearn, Simple Metacharacters and Character Classes. Take notes which you can use while taking a short quiz on this material.

Evaluation

You will be evaluated equally on your git repo and your quiz score.

Monday, February 24th

Classwork

We will see the presentations on the research assigned last week, and then as time permits begin writing unit tests from our agreed upon user stories

Homework

Read the following two tutorials:

  1. The first block of the Regular Expression module in our SoloLearn course, named appropriately, Regular Expressions.
  2. Read through this tutorial introduction to regular expressions in vim.

Finally, take a look at the regular expressions 101 website, which provides a web application allowing you to see dynamically how regular expressions are evaluated.

Evaluation

We will have a quiz on this material when you come to class on Wednesday. Make sure you can write the command for a simple global substitution in vim. As always, the quiz will be open note and you can earn up to two points for having good notes.