master
Matt Huntington 9 years ago
parent 265db1feef
commit 8ada4b1d6e

@ -67,7 +67,6 @@ To create an algorithm for a computer program, there are a few steps to follow:
1. Think about the larger solution as a whole, but as a series of steps that you would write out for a petulant child to follow 1. Think about the larger solution as a whole, but as a series of steps that you would write out for a petulant child to follow
1. Write out the solution in plain English, breaking it down into as many tiny steps as possible. Remember, this child doesn't want to do the task. If there's any ambiguity, you're sunk 1. Write out the solution in plain English, breaking it down into as many tiny steps as possible. Remember, this child doesn't want to do the task. If there's any ambiguity, you're sunk
1. Create a flow chart (decision tree) 1. Create a flow chart (decision tree)
![musical flow chart](http://i.imgur.com/J1iNj.jpg)
1. Write Pseudo code for the algorithm (explained below) 1. Write Pseudo code for the algorithm (explained below)
1. Write computer code to solve the issue 1. Write computer code to solve the issue

@ -96,7 +96,9 @@ a = [
You can conceptualize a list of lists however you want You can conceptualize a list of lists however you want
**ACTIVITY: How would you change the previous example so that each inner list is a column?** ### ACTIVITY
How would you change the previous example so that each inner list is a column?
## Access an element of a list ## Access an element of a list
@ -134,9 +136,24 @@ You can also compare strings:
```python ```python
a = 'oh hai!' a = 'oh hai!'
if a == 'oh hai!': if a == 'oh hai!':
print 'works' print 'this works'
```
## Get user input
You can get user input from the command like so:
```python
user_input = raw_input("Please enter something: ")
print "you entered: " + user_input
``` ```
### ACTIVITY
Write a program that models this flow chart:
![where should I post that?](http://socialnewsdaily.com/wp-content/uploads/2013/04/where-do-i-post-it.jpg)
## Repeatedly perform a set of commands ## Repeatedly perform a set of commands
```python ```python
@ -146,11 +163,16 @@ while a < 20:
a = a + 1 a = a + 1
``` ```
## Get user input ### ACTIVITIES
You can get user input from the command like so: 1. Write a program that models this flow chart:
```python ![where should I post that?](http://socialnewsdaily.com/wp-content/uploads/2013/04/where-do-i-post-it.jpg)
user_input = raw_input("Please enter something: ")
print "you entered: " + user_input 1. Given the following list [70, 95, 97, 55, 3, 24, 89, 97, 84, 11]
``` - Write a program that loops through each value in the list and prints it
- Write a program that loops through each value in the list and adds them all together
- Write a program that loops through each value in the list and prints the average
- Write a program that loops through each value in the list and prints the minimum
- Write a program that loops through each value in the list and prints the maximum
1. Combine all the programs from the previous step into one program that asks the user what operation they would like to do

Loading…
Cancel
Save