Difference between revisions of "IB Computer Science 1"

From WLCS
Line 39: Line 39:
  
 
== Archives ==
 
== Archives ==
 +
* [[IBCS1 - 1819 - February]]
 
* [[IBCS1 - 1819 - January]]
 
* [[IBCS1 - 1819 - January]]
 
* [[IBCS1 - 1819 - December]]
 
* [[IBCS1 - 1819 - December]]

Revision as of 21:55, 5 March 2019

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