Previous Lecture Lecture 3 Next Lecture

Lecture 3, Tue 01/14

Git, Functions, Loops

Three key aspects of functions

Variable scope

Designing nested loops

Math Puzzle One of the powers of computing is being able to do a brute-force search for a solution to a problem. Trial and error works just fine for some problems. In fact, computers can be especially good at such problems. Consider this:

Horses cost $10, pigs cost $3, and rabbits are only $0.50. A farmer buys 100 animals for $100, How many of each animal did he buy?

Write a program to do this.

https://ucsb-cs16-m18.github.io/lectures/lect03/