Logic and the flow of Control

by Elliott Hauser

22 May 2018

Q&A

  • Community engagement - Get started now!
  • Open Source contributions - now Extra Credit

Logistics

Moving forward, you’ll review and merge each others’ work in class.

Review, fix, and close issues assigned to you. We’ll have some catch-up time where we can review any outstanding issues.

Merging!

With great power comes great responsibility

  • Never merge your own pull request
  • Never commit directly to the master branch Imgur
  • Never merge broken or failing code
  • Always be explicit with your reviews:

screenshot 2018-05-22 at 5 24 53 pm

Review & Merge Posts

Volunteer: Merging with Tommy Tester.

  • Reviewing PRs - comment on them directly
  • Create a formal Review to Approve or Request Changes. Leave comments on a specific line if needed. Request changes on an open PR. Open an issue if the code has already been merged - that way, issues are with the current site, and problems with new code say in the PR.
  • Merging - Your responsibility to make sure your partner’s post works! Check that it shows up on our site afterwards. Code > Commits will let you see whether the site has been rebuilt (takes ~1 minute)
  • Assigning issues - already merged work with problems

~10 minutes reviewing & merging posts with a partner.

Discussion: Logic and the Flow of Control

Boolean values are very simple but very powerful. There are tons of useful ways to construct expressions that evaluate to True or False in Python, and we use these to change the behavior of our program.

Basic if statements act as ‘gates’ to control whether blocks of code get executed. elif and else statements enhance this control.

In Class exercise

Logical Turtles!

Logical Turtles code talks

  • Story of your approach
  • Your triumphs
  • Your despairs
  • Problem Solving attitudes and strategies

Functions & Refactoring for Next time

Read up on functions and then use the power of custom functions to make your previous code more concise and more awesome!

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.