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
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:
- Finish remaining blocks of the (.*) Regular Expressions module in SoloLearn: More Metacharacters, Groups, Special Sequences, Email Extraction, and Module 8 Quiz.
- 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!
Work with your partner to prepare a presentation on the following for class on Thursday:
- What are regular expressions?
- How can you use regular expressions in Python?
- What are metacharacters? What are character classes?
- What are groups? How can groups be extracted from a string?
- What is the relevant information we need to extract from a string
representation of a polynomial? How can we use the
remodule to accomplish this?
Your evaluation for next week will be determined by the completeness and correctness of your presentation.
Wednesday, February 26th
We will start with a short, Regular Expressions 1 quiz, and then use
the rest of class time to work on our
Complete the next two blocks from the (.*) Regular Expressions module
Simple Metacharacters and
Character Classes. Take notes which you can use while taking a
short quiz on this material.
You will be evaluated equally on your git repo and your quiz score.
Monday, February 24th
Read the following two tutorials:
- The first block of the
module in our SoloLearn course, named appropriately,
- 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.
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.