diff --git a/algorithms.md b/algorithms.md index 5fc273a..9a462e6 100644 --- a/algorithms.md +++ b/algorithms.md @@ -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. 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) - ![musical flow chart](http://i.imgur.com/J1iNj.jpg) 1. Write Pseudo code for the algorithm (explained below) 1. Write computer code to solve the issue diff --git a/python.md b/python.md index 16070f4..741964e 100644 --- a/python.md +++ b/python.md @@ -96,7 +96,9 @@ a = [ 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 @@ -134,9 +136,24 @@ You can also compare strings: ```python 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 ```python @@ -146,11 +163,16 @@ while a < 20: 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 -user_input = raw_input("Please enter something: ") -print "you entered: " + user_input -``` + ![where should I post that?](http://socialnewsdaily.com/wp-content/uploads/2013/04/where-do-i-post-it.jpg) + +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