jan 22
resources
language
- start with python
- do some lisp in a few weeks
basic techniques
- create/edit a file
- (mention spyder: Alec K likes it)
- get to the command line
- run python on it
- ssh to cs
- do all that remotely
we did this in class
#!/usr/bin/env python
"""
This is an example in class of a python program.
"""
def factorial(n):
answer = 1
for i in range(2, n+1):
answer *= i
return answer
print "what is n? ",
number = int(raw_input())
fact = factorial(number)
print "factorial(" + str(number) + ") = " + str(fact)
we got to here
group problem
- find the first few perfect numbers
- 6 is perfect : factors 1,2,3,6 and 1+2+3=6
methods of approach
- approaches: top-down vs bottom-up
- algorithm/dataflow in pseudo code
- break into sub-problems
- code/test/document sub-problems
questions / comments ?