Fall 2021
-->

# Sep 14

## projects

I've decided on specific deadlines for the 1 credit projects which I'll discuss briefly - see the projects page.

Discuss what you've done so far ... and what I'd like you to do for the next two weeks; see the assignments page & the share/adventofcode pages.

You can work on these on your own or with a partner. I've posted code by me and a link to Peter Norvig's work. Please try to do these yourself first, then compare and consider other solutions. Submit and discuss your work on the homework page.

Please choose at least one part of one problem to share in the share/adventofcode/2017/you/ folder - anonymous or signed, up to you.

a few coding notes :

# reading in from a file
numbers = list(map(int, list(open("input.txt").read().strip())))  # file.txt has '123456....'
# ... and how to come up with expressions like that

• python has a sum(numbers) built in ...
• "list comprehension" : [f(x) for x in some_sequence] can be powerful
• as things get trickier, do test your functions on the examples given

## regexes

And I'd like to practice some regexes during class.

Would it help for me to go over the basics?

• What they are (text matching patterns) & what they can do : (match yes/no, capture, replace)
• Also has a formal definition in CS math theory ; similar but not quite same as the software libraries
• a common "domain specific language" within other coding languages
• syntax basics ...
• using them in language X ... details vary.

So ... let's pick one to try, say from w3resource . Here's their answer .

Given a string like "https://foo.com/some/stuff/2020/09/29/more" ,
extract the date as a numeric tuple (2020, 9, 29), using
python regular expressions.


I've uploaded the code that worked out in class for this one.

https://cs.bennington.college /courses /fall2021 /coding /notes /09-14