15-112 Agenda 24-May
- Feedback loop
- daily hw tells you where you are
- reports, autolab,etc
- all nighters / sleep
- Schedule adjustment
- Extra office hours on Friday
- Switching between screens feedback
- Code Block Of The Day
from twilio.rest import Client account_sid = "FILL_ME_IN" auth_token = "FILL_ME_IN" Client(account_sid, auth_token).api.account.messages.create( to="FILL_ME_IN", from_="+12062032019", body="hi" )
- Reading submitted code: loops on hw1 ; cheating
- Audit clarification
- Normal student enrolled for a grade
- Officially Audit
- registered on SIO
- full access to normal course resources (office hours, quizzes, etc)
- not required to take exams, successful participation assessed by homeworks + TP. Can be negotiated with instructor.
- Sit in on lecture
- not registered on SIO
- can sit in on lecture and be on autolab/piazza
- no access to office hours, no quizzes, etc.
- Why we care about the next 3 topics
- Smart ship USS Yorktown was left dead in the water in 1997 for nearly 3 hours after a divide by zero error.
- Toyota’s electronic throttle control system (ETCS) had bugs that could cause sudden unintended acceleration.
- Knight Capital Group
- lost $440 million in 45 minutes
- 75% of its value in 1 day
- used to handle 22billion trades a day
- Mars Climate Orbiter was also destroyed, due to software on the ground generating commands in pound-force (lbf), while the orbiter expected newtons (N).
- Testing
- Review of how a test function works + deeper explanation of starter file
- Elements of a good test function
- Console + Graphics (not responsible, but brief overview)
- Simple try/except (not responsible for anything beyond try/except)
- Style
- Lots of places have different style guides, you don’t stick with your own
- Overview of style rules
-
Debugging
- Syntax: Read the error, find the line, look at lines near it
def isCrazyMathNum(x): works = (x + (x//(2) + (x**2 / x)) print(works) return works
- Runtime + Logic
- Find the smallest test case to make it fail
- Add print statements for your variables + where the code has reached
- Trace what you think should happen
- Run it and compare
def abs(x): if x < 0: x == -x return x print(abs(-3))
-
Leftovers
- Day1: Getting Started
Syntax, Runtime, Logical ErrorsConsole InputOther modules
- Day1: Data and Expressions
notoperatorShort circuit evaluation
- Day1: Functions
Vocab
- Day3: Strings
Basic File IO
- Day1: Getting Started
- Check: https://tinyurl.com/summer112att4
- Quiz (this section will probably be moved to Friday’s lecture)
- Quiz Tuesday in recitation, review during lecture Tuesday
- Quiz covers Syllabus,day1, day2, day3, and day4 (lightly)
- What does a quiz look like?
- Strings roc1 and how to approach roc problems
- How to approach FR problems (spend a bit planning, but make sure to write code)
- How to approach the quiz in general (ct + roc no credit for scratch work)