Difference between revisions of "IB Computer Science 1"

From WLCS
Line 1: Line 1:
== Monday - Tuesday (11/17/14 - 11/18/14) ==
+
== Monday - Tuesday (11/24/14 - 11/25/14) ==
 +
'''Agenda:'''
 +
* Demo [[Advanced Python List Exercises]]
 +
* List & String Practice
 +
*# 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>
 +
 
 +
== Monday - Friday (11/17/14 - 11/21/14) ==
 
'''Agenda:'''
 
'''Agenda:'''
 
* Complete all exercises from [http://codingbat.com/python/List-2 List-2]
 
* Complete all exercises from [http://codingbat.com/python/List-2 List-2]

Revision as of 09:17, 24 November 2014

Monday - Tuesday (11/24/14 - 11/25/14)

Agenda:

  • Demo Advanced Python List Exercises
  • List & String Practice
    1. Assume you have a list of strings of peoples' full names in random order. Print out an alphabetized list of only the last names.
    2. 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.
    3. 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:

Thursday - Friday (11/13/14 - 11/14/14)

Agenda:

Monday - Wednesday (11/10/14 - 11/12/14)

Agenda:

Thursday - Friday (11/7/14 - 11/7/14)

Agenda:

Monday - Wednesday (11/3/14 - 11/5/14)

Agenda:

Archives