CS 61A: Structure and Interpretation of Computer Programs - week1 - 1

120 阅读1分钟

准备夯实一下自己的计算机技术基础,跟着John Denero 学习 Structure and Interpretation of Computer Programs,可惜用的是python,python就python吧,我也可以趁机捡一下python。

第一个video没什么特别的,就是介绍一下资源,规则,嗯,我也不知道能不能用得到,真希望coursera或者edX能同样的课。结尾的时候John说,嗯,到时间了,但是反正是internet,你们想走可以走,我还是要继续讲一讲的。

以下是课程会涉及到的内容:

  1. A course about managing complexity

    。Mastering abstraction

    。Programming paradigms

  2. An introduction to programming

    。Full understanding of Python fundamentals

    。Combining multiple ideas in large projects

    。How computers interpret programming languages

    。Different types of languages: Scheme & SQL

John又讲到上课的policy:一定不能复制别人的代码,学习是在不能解决问题时才发生的。嗯,我要改掉经常复制代码的坏毛病,以及特别急切想要解决问题的心态。fighting

John demo的code:

# Numeric expressions
-1 + 2 + 3 + 4 * ((5 // 6) + 7 * 8 * 9)

# Functions
abs(-2)

# Objects
# Note: Download from http://composingprograms.com/shakespeare.txt
shakes = open('shakespeare.txt')
text = shakes.read().split()
len(text)
text[:25]
text.count('the')

# Sets
words = set(text)

# Combinations 
{w[0] for w in words}

# Data
'draw'[::-1]
{w for w in words if w == w[::-1] and len(w)>4}
{w for w in words if w[::-1] in words and len(w) == 4}