IB Computer Science 1

From WLCS
Revision as of 13:51, 13 March 2019 by Admin (talk | contribs)
Jump to: navigation, search

Thursday (3/14/19)

Agenda:

  • Complete the List Review Exercises repl.it if you have not already done so
  • Go over Python List Exercises
  • Basic Lists Quiz
  • Complete the rest of the List repl.its
    • Search, Min, Max, Reverse

Tuesday (3/12/19)

Warmup:

  • Complete the List Review Exercises repl.it

Agenda:

Friday (3/8/19)

Agenda:

  • Today: Morse Code Sound Player
  • Time module
    • Time module demo
    1. import time (at the top of your program)
    2. Write a while loop that prints "Hello" 5 times
    3. You can add a 1 second delay by using time.sleep(1)
    4. Try sleeping for a second before "Hello" is printed
  • How to play a sound file using os.system()
    1. Download Media:Dot.wav and Media:Dash.wav
    2. Create a python file to test out playing sound
    3. import os
    4. os.system("afplay FILENAME")
    5. make sure that the python file and the sound are in the same folder/director
  • Morse Code Sound Player
    1. Create a new file named morseCodePlayer.py
    2. Copy your plain->morse translation code
    3. Using the time and os modules, you will write a program that allows the user to input a string. The program will then translate to morse code, display the textual morse code, AND play the morse code sounds
    4. You may use the following sound files: Media:Dot.wav and Media:Dash.wav
    5. After your translate to morse code, you should iterate through your morse code string and check to see what each character is in order to play the appropriate sound (if the character is a dot, then play the dot sound).
    6. Whenever there is a space, you should sleep for about 50 milliseconds
  • Introduction to Lists

Wednesday (3/6/19)

Warmup:

  • Write a function named isDigit(ch) that returns True if the string ch is a digit character, and False otherwise
  • Submit your solution to the repl.it for warmup credit

Agenda:

  • Date Format Validation cont'd
    • If you have not completed Date Format Validation already, then you can use isDigit() to help you
  • Complete E-mail Harvester
  • E-mail Harvester Challenges:
    • Modify e-mail harvester so that it reads from a file
    • Modify e-mail harvester so that multiple e-mails can be found/printed
    • Test the file reading, multiple e-mail harvester by processing the HTML from some website

Monday (3/4/19)

Agenda:

  • Confirm that you have completed and submitted the Count Vowels and Count Words repl.its
  • Date Format Validation repl.it (no loops)
    1. You will define a function named checkDateFormat(dateStr) that takes a string as a parameter. Your function will return True if the date string is valid, and False otherwise
    2. A date string is valid if it adheres to the following rules:
      1. Must be in the format: MM/DD/YYYY
      2. MM must be a valid 2-digit month (01 -> 12)
      3. DD must be a valid 2-digit day (01 -> 31)
      4. YYYY must be a 4-digit number
    3. Guidance: You should use any and/or all programming strategies to help you define the function: checking the string length, string slicing, checking if specific characters are valid, defining helper functions, etc..
    4. Submit to repl.it
  • E-mail Harvester repl.it
    1. You will define a function named harvestEmail(s) that takes a string as a parameter. Your function will return the e-mail address within the string s
    2. Assume that the s parameter will have an e-mail address and all e-mail addresses have an @ symbol
    3. Use a loop to find the index of the @ symbol. Basically, check if each character is the @ symbol, and if it is, then remember the current index. Be sure to break out of the loop when you find the @ symbol
    4. Use a loop to find the index of the space " " character before the @ symbol (this is the beginning of the e-mail address). Hint: Start your loop counter at the index of the @ symbol, and count backwards/downwards. Be sure to break out of the loop when you find the space
    5. Use a loop to find the index of the space " " character after the @ symbol (this is the end of the e-mail address). Hint: Start your loop counter at the index of the @ symbol. Be sure to break out of the loop when you find the space
    6. Return the e-mail address by string slicing the indices of the beginning and end of the e-mail address
    7. Submit to repl.it
  • Challenges:
    • Modify e-mail harvester so that it reads from a file
    • Modify e-mail harvester so that multiple e-mails can be found/printed
    • Test the file reading, multiple e-mail harvester by processing the HTML from some website

Archives

Thursday (3/14/19)

Agenda:

  • Complete the List Review Exercises repl.it if you have not already done so
  • Go over Python List Exercises
  • Basic Lists Quiz
  • Complete the rest of the List repl.its
    • Search, Min, Max, Reverse

Tuesday (3/12/19)

Warmup:

  • Complete the List Review Exercises repl.it

Agenda:

Friday (3/8/19)

Agenda:

  • Today: Morse Code Sound Player
  • Time module
    • Time module demo
    1. import time (at the top of your program)
    2. Write a while loop that prints "Hello" 5 times
    3. You can add a 1 second delay by using time.sleep(1)
    4. Try sleeping for a second before "Hello" is printed
  • How to play a sound file using os.system()
    1. Download Media:Dot.wav and Media:Dash.wav
    2. Create a python file to test out playing sound
    3. import os
    4. os.system("afplay FILENAME")
    5. make sure that the python file and the sound are in the same folder/director
  • Morse Code Sound Player
    1. Create a new file named morseCodePlayer.py
    2. Copy your plain->morse translation code
    3. Using the time and os modules, you will write a program that allows the user to input a string. The program will then translate to morse code, display the textual morse code, AND play the morse code sounds
    4. You may use the following sound files: Media:Dot.wav and Media:Dash.wav
    5. After your translate to morse code, you should iterate through your morse code string and check to see what each character is in order to play the appropriate sound (if the character is a dot, then play the dot sound).
    6. Whenever there is a space, you should sleep for about 50 milliseconds
  • Introduction to Lists

Wednesday (3/6/19)

Warmup:

  • Write a function named isDigit(ch) that returns True if the string ch is a digit character, and False otherwise
  • Submit your solution to the repl.it for warmup credit

Agenda:

  • Date Format Validation cont'd
    • If you have not completed Date Format Validation already, then you can use isDigit() to help you
  • Complete E-mail Harvester
  • E-mail Harvester Challenges:
    • Modify e-mail harvester so that it reads from a file
    • Modify e-mail harvester so that multiple e-mails can be found/printed
    • Test the file reading, multiple e-mail harvester by processing the HTML from some website

Monday (3/4/19)

Agenda:

  • Confirm that you have completed and submitted the Count Vowels and Count Words repl.its
  • Date Format Validation repl.it (no loops)
    1. You will define a function named checkDateFormat(dateStr) that takes a string as a parameter. Your function will return True if the date string is valid, and False otherwise
    2. A date string is valid if it adheres to the following rules:
      1. Must be in the format: MM/DD/YYYY
      2. MM must be a valid 2-digit month (01 -> 12)
      3. DD must be a valid 2-digit day (01 -> 31)
      4. YYYY must be a 4-digit number
    3. Guidance: You should use any and/or all programming strategies to help you define the function: checking the string length, string slicing, checking if specific characters are valid, defining helper functions, etc..
    4. Submit to repl.it
  • E-mail Harvester repl.it
    1. You will define a function named harvestEmail(s) that takes a string as a parameter. Your function will return the e-mail address within the string s
    2. Assume that the s parameter will have an e-mail address and all e-mail addresses have an @ symbol
    3. Use a loop to find the index of the @ symbol. Basically, check if each character is the @ symbol, and if it is, then remember the current index. Be sure to break out of the loop when you find the @ symbol
    4. Use a loop to find the index of the space " " character before the @ symbol (this is the beginning of the e-mail address). Hint: Start your loop counter at the index of the @ symbol, and count backwards/downwards. Be sure to break out of the loop when you find the space
    5. Use a loop to find the index of the space " " character after the @ symbol (this is the end of the e-mail address). Hint: Start your loop counter at the index of the @ symbol. Be sure to break out of the loop when you find the space
    6. Return the e-mail address by string slicing the indices of the beginning and end of the e-mail address
    7. Submit to repl.it
  • Challenges:
    • Modify e-mail harvester so that it reads from a file
    • Modify e-mail harvester so that multiple e-mails can be found/printed
    • Test the file reading, multiple e-mail harvester by processing the HTML from some website

Archives