Skip to content

Homework 1

Jinho D. Choi edited this page Jan 29, 2018 · 11 revisions

Preparation

Download hw1.py.

Regular Expressions

Write regular expressions in Python matching the following cases (one expression per case):

  • Phone numbers (e.g., +1(800) 123-4567)
  • Dates (e.g., March 1, 2018)
  • Emoticons (e.g., :-), :P)

Use the template in hw1.py for your expressions:

RE_PHONE_NUMBER = re.compile('your expression')
RE_DATE = re.compile('your expression')
RE_EMOTICON = re.compile('your expression')

Try to cover as many patterns as possible. Be aware that these cases can occur anywhere in a document. In the report, briefly explain what kind of groups you make in your expressions.

Normalization

Normalize numbers in various formats into digits:

  • One million five thousands twenty four → 1005024.
  • 2 hundreds two → 202.

Complete the norm_number function in hw1.py:

Exam Scheduler

Your task is to implement a program that takes a list of course numbers (e.g., QTM385-1, CS323-1) and returns their final exam schedule sorted by data and time.

Practical Approaches to Data Science with Text

Instructor


Emory University

Clone this wiki locally