Regex & basic search

by Elliott Hauser

06 Jun 2017

Q & A

  • Please turn things in on time! Zeros are no fun. The assignments list is your friend.
  • My reflection responses to you will come out probably over the weekend. Look for an email.
  • Overall message: positive, strategies are working, need to dig in more with the details.
  • So we will!

Reflections Review.

In your words:

  • “Sometimes learning python has been exhilarating; sometimes it has been exhausting.”
  • “Even though I’ve accomplished a lot in this class, I’m not sure how much of it I’m actually learning and how much is just coincidentally working out.”
  • “Most of the time, my “go to” problem solving strategy is to print as I go along. This helps me ensure that the program is working appropriately step-by-step.”
  • “Overall, one of the best problem solving strategies that works for me is reading what the assignment is as soon it’s assigned or before it’s assigned and not working on it for a few hours to a day. I’ll brainstorm the problem away from my laptop and try to come up with potential creative ideas that I can execute.”
  • “Being this is my first time programming, I experience confusion during every exercise, but can normally figure out a way to solve whatever I’m doing. It’s definitely made me realize how coding is an iterative process.”
  • “I’m still not a confident as I’d like to be with the list/string operations. I see those as potentially useful in my work, so getting more practice with those would probably do me some good.”
  • “I ended up commenting ahead of actually getting things working and they were little helpful guides or mini-milestones that helped get me unstuck. I started making much better progress once I commented out the plan a bit.”
  • “Usually I jump right in without a game plan, creating much chaos in my code that I can’t remember what I was trying to obtain even with comments. Now I try to set up some sort of plan I can follow, but occasionally jumping right in gives me the prefect boost I need to give me a start on my work.”
  • “I guess in a wider sense, I’m uncertain where the best places to go are for explanations of Python’s capabilities.”
  • “Just getting away from the computer and refreshing my brain has done wonders. I had to walk away from the computer at least twice when writing my slam poetry code. When you come back the code becomes a fresh canvas in which you can see the issues more clearly and you dont get caught up in what you have already written. “
  • “I have also found working with a partner has been very useful. Sometimes just because they know something you dont, but mostly because it makes you form your ideas fully in order to explain it to your partner and it becomes clear whether or not it will work or not much faster. “
  • “My favorite strategy has been going back and looking at my or others old work. Often times, something I want to do for a current exercise, has been done in a similar circumstance in either one of my previous exercises or in other classmates previous exercises.”

Lists, loops, strings

Let’s review!

Go here to see my code.

  • For loops loop over lists. Let’s translate
  • Build a string from a list two ways: .join and for loop.
  • Fancy formatting: Multiplying strings "-"" * 16
  • Lists of lists: first, slice your rows. Then, slice the cells you want.
  • Adding lists together (if it’s not a list, make it one!)
  • Removing stuff from lists
  • Functions and global variables
  • Put it all together: CSV1 Answer

Files

Slam Poetry Files Review.

For this you need to:

  • Collect user input (as you were already doing)
  • Write that to a file in addition to writing it to the screen.

Pair up/merge up.

Regexes POSTPONED

We were going to do this today but I think we need a breather to discuss loops, lists, strings, and files together.

If you’re disappointed about this, check out https://regexcrossword.com/.

Drawing App or Blackjack Clinic

It’s time. Due tomorrow!

Stay after class for some help.

Elliott Hauser is a PhD Student in information science at UNC Chapel Hill. He's hacking education as one of the cofounders of Trinket.io. Find Elliott Hauser on Twitter, Github, and on the web.