Reading / Journal 3
Strings and IO ✏️
Journals are a combination of a few things. First, the "journal." This is a very small weekly assignment where you write 200+ words (option 1) or submit "tinker" code (option 2). Second, the "reading." This is where I direct you to read from a book, an online article, or watch a video, and I supplement those with my own lecture notes, graphs, figures, quotes, or so on.
All other assignments and lectures build upon these. Usually, there will be more reading at the start of a unit and less at the end.
Reading
So far we've seen numeric variables.
Python has a lot of power with processing string variables, ie, variables containing text data like names and email addresses.
Unlike other languages, you can use single or double quotes for strings in Python:
x = "hello"
y = 'hello'
You can also use "triple" quotes for longer strings that span multiple lines:
x = """
There was no possibility of taking a walk that day. We had been
wandering, indeed, in the leafless shrubbery an hour in the morning; but
since dinner (Mrs. Reed, when there was no company, dined early) the cold
winter wind had brought with it clouds so sombre, and a rain so
penetrating, that further out-door exercise was now out of the question.
"""
y = '''
I was glad of it: I never liked long walks, especially on chilly
afternoons: dreadful to me was the coming home in the raw twilight, with
nipped fingers and toes, and a heart saddened by the chidings of Bessie,
the nurse, and humbled by the consciousness of my physical inferiority to
Eliza, John, and Georgiana Reed.
'''
This means that unlike Java and C, Python does not have a way to represent variables that contain a single character. To do that, just use a string that happens to have only a single character.
Next, Python has a long list of built-in string functions. These are useful in the many situations you may find yourself in when your program needs to process text-based data that was entered by a user, scraped from the web, or so on.
There is no guanrantee that text data found "in the wild" will be "clean," ie, free of weirdness like empty space at the beginning, end, or stray ch]aracters in the mid;dle of words. You might also want to divide a longer string (an entire book) into a list of strings (the paragraphs) so that you can analyze them individially and find patterns as we progress through the story.
So, the built-in string functions Python has are intended to give you quick solutions for those common concerns.
Now read "Python String Methods" from https://www.w3schools.com/python/python_ref_string.asp
And read Chapter 4 from our textbook
Journal
Choose from one of the following two options as you best see fit:
Option One: Submit a brief "200+ Words" reflecting on the reading and/or the course as a whole. These 200+ words are expected to come completely from the student, ignoring words from quotes/etc. The format of these assignments is up to the student as it best helps them: bulleted point notes on the reading; questions directed at the instructor of course material; a paragraph reflecting on the Lab assignment for the week; a poem; a summary of recent technology news; anything, so long as it is turned in on time, is relevant to the course, and meets the required length.
Option Two: Submit a brief "Tinker" where you have attempted to "program" something, using the tools of the course, that is not directly related to another course assignment. Include screenshots of the input work done and the output result (even if it does not work), along with a brief statement of your intentions, the approach you took in getting it to work, and your thoughts on your result so far. Make sure it is clear what code came from you and what came from online/the reading/etc.
Short a few words in your journal and don't know what else to write about?
This week's "get to know you" question is:
Reflect on a relationship in your life that has evolved or strengthened over time. (Credit)
Feel free to write about this a little bit in your journal.
Submission
Submit your journal as a Word/PDF (NOT a .pages) document to Blackboard.
Grading
Journals are each worth 1/100 towards your final grade. Grading is pass/fail based on meeting the requirements of the chosen option.