Difference between revisions of "IB Computer Science 1"
From WLCS
Line 1: | Line 1: | ||
+ | == Wednesday - Thursday (12/3/14 - 12/4/14) == | ||
+ | '''Agenda:''' | ||
+ | * List & String Practice | ||
+ | *# Test out the snippet of code below | ||
+ | *# Analyze how it each line works and what each line does | ||
+ | *# Try to complete the following exercises | ||
+ | *# Assume you have a list of strings of peoples' full names in random order. Print out an alphabetized list of only the last names. | ||
+ | *# Assume you have a single string containing the entire U.S. Constitution. Calculate and print out the frequency of the word "the" | ||
+ | *#* Download the following file: [[Media:Constitution.txt]] | ||
+ | *#* Hint: There is a useful string function converts a string to a list of words. | ||
+ | *# Assume you have a single data file with 1000 random numbers from 0 to 100. Print out the frequency of each of the numbers. | ||
+ | *#* Example code to help read in a file: | ||
+ | <syntaxhighlight lang="Python"> | ||
+ | # open a text file | ||
+ | file = open("Constitution.txt", "r") | ||
+ | |||
+ | # read all lines in the file and save in the constitution string variable | ||
+ | constitutionStr = file.read() | ||
+ | |||
+ | # close the file | ||
+ | file.close() | ||
+ | |||
+ | print(constitutionStr) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Read and watch [http://www.kirix.com/blog/2008/07/22/fun-and-fraud-detection-with-benfords-law/ Benford's Law and Fraud Detection] | ||
+ | * Further reading [http://mathworld.wolfram.com/BenfordsLaw.html Benford's Law] | ||
+ | * Research and find a set of naturally occurring numbers. Here are some ideas, but you can come up with your own: | ||
+ | ** [http://www.census.gov/ U.S. Census Bureau] | ||
+ | ** Heights of mountains | ||
+ | ** Atomic weights in the periodic table | ||
+ | ** Baseball statistics | ||
+ | ** etc. | ||
+ | * Create a text file that contains a list of your numbers (try to have a list of 1000 numbers if possible) | ||
+ | |||
== Monday - Tuesday (12/1/14 - 12/2/14) == | == Monday - Tuesday (12/1/14 - 12/2/14) == | ||
'''Agenda:''' | '''Agenda:''' |
Revision as of 08:29, 3 December 2014
Contents
- 1 Wednesday - Thursday (12/3/14 - 12/4/14)
- 2 Monday - Tuesday (12/1/14 - 12/2/14)
- 3 Monday - Tuesday (11/24/14 - 11/25/14)
- 4 Monday - Friday (11/17/14 - 11/21/14)
- 5 Thursday - Friday (11/13/14 - 11/14/14)
- 6 Monday - Wednesday (11/10/14 - 11/12/14)
- 7 Thursday - Friday (11/7/14 - 11/7/14)
- 8 Monday - Wednesday (11/3/14 - 11/5/14)
- 9 Archives
Wednesday - Thursday (12/3/14 - 12/4/14)
Agenda:
- List & String Practice
- Test out the snippet of code below
- Analyze how it each line works and what each line does
- Try to complete the following exercises
- Assume you have a list of strings of peoples' full names in random order. Print out an alphabetized list of only the last names.
- Assume you have a single string containing the entire U.S. Constitution. Calculate and print out the frequency of the word "the"
- Download the following file: Media:Constitution.txt
- Hint: There is a useful string function converts a string to a list of words.
- Assume you have a single data file with 1000 random numbers from 0 to 100. Print out the frequency of each of the numbers.
- Example code to help read in a file:
# open a text file
file = open("Constitution.txt", "r")
# read all lines in the file and save in the constitution string variable
constitutionStr = file.read()
# close the file
file.close()
print(constitutionStr)
- Read and watch Benford's Law and Fraud Detection
- Further reading Benford's Law
- Research and find a set of naturally occurring numbers. Here are some ideas, but you can come up with your own:
- U.S. Census Bureau
- Heights of mountains
- Atomic weights in the periodic table
- Baseball statistics
- etc.
- Create a text file that contains a list of your numbers (try to have a list of 1000 numbers if possible)
Monday - Tuesday (12/1/14 - 12/2/14)
Agenda:
- Demo any missing assignments
- File Input/Output (reading/writing)
- List & String Practice
- Test out the snippet of code below
- Analyze how it each line works and what each line does
- Try to complete the following exercises
- Assume you have a list of strings of peoples' full names in random order. Print out an alphabetized list of only the last names.
- Assume you have a single string containing the entire U.S. Constitution. Calculate and print out the frequency of the word "the"
- Download the following file: Media:Constitution.txt
- Hint: There is a useful string function converts a string to a list of words.
- Assume you have a single data file with 1000 random numbers from 0 to 100. Print out the frequency of each of the numbers.
- Example code to help read in a file:
# open a text file
file = open("Constitution.txt", "r")
# read all lines in the file and save in the constitution string variable
constitutionStr = file.read()
# close the file
file.close()
print(constitutionStr)
Monday - Tuesday (11/24/14 - 11/25/14)
Agenda:
- Demo Advanced Python List Exercises
- List & String Practice
- Test out the snippet of code below
- Analyze how it each line works and what each line does
- Try to complete the following exercises
- Assume you have a list of strings of peoples' full names in random order. Print out an alphabetized list of only the last names.
- Assume you have a single string containing the entire U.S. Constitution. Calculate and print out the frequency of the word "the"
- Download the following file: Media:Constitution.txt
- Hint: There is a useful string function converts a string to a list of words.
- Assume you have a single data file with 1000 random numbers from 0 to 100. Print out the frequency of each of the numbers.
- Example code to help read in a file:
# open a text file
file = open("Constitution.txt", "r")
# read all lines in the file and save in the constitution string variable
constitutionStr = file.read()
# close the file
file.close()
print(constitutionStr)
Monday - Friday (11/17/14 - 11/21/14)
Agenda:
- Complete all exercises from List-2
- Work on Advanced Python List Exercises
Thursday - Friday (11/13/14 - 11/14/14)
Agenda:
- Review (Basic) Python List Exercises
- Make sure you turn it in via Google Classroom
- Complete 6 exercises from List-1
- Complete 3 exercises from List-2
Monday - Wednesday (11/10/14 - 11/12/14)
Agenda:
- Review Pig Latin Translator
- Lists - Media:Lists_Python.ppt
- Complete (Basic) Python List Exercises and turn it in via Google Classroom
- Complete it before the end of class
Thursday - Friday (11/7/14 - 11/7/14)
Agenda:
- String review
- Complete Pig Latin Translator
Monday - Wednesday (11/3/14 - 11/5/14)
Agenda:
- Demo Morse Code Translator
- Work on Pig Latin Translator