Project 2 involves creating some Python code to generate html for me. This sounds exciting. I've only played around with Python a handful of times so this will be new territory for me. Very exciting!
11:22am
Python code is saved with the extension of .py
Running Python on a Mac is super simple. Open the terminal and type "python" press return and bam. Python running on the mac. To write code that you can save simply open your favorite IDE (I like atom 1.0 or sublime 3) and save your file with extension .py.
In Project 2 I'll learn how to use variables effectively and how to write functions to do repetitive work...we'll let's say review. I've been here before.
Informed it's time to clean the house...this may take awhile..
11:33 am
Back in the seat! 1:10 pm
Working through Introduction to Computer Science courses. I've taken this course in the past. Dave breaks down the basics into very simple concepts. In my experience, Udacity courses have been spot-on about 95% of the time.
Computers enable making repetitive steps at incredible speeds.
Some examples of the methods of thinkings:
Procedural thinking...follows instructions in code
Technological empathy as to how the computer interprets the code
Abstract thinking when conceptually understanding that a Python program, Python interpreter and web browser are different versions of the same thing (a program).
Natural languages can be full of ambiguity and verbosity. Computer programs must be precise and concise. This is why computer languages exist and computers do not operate in English or Mandarin or some other human language.
However, Python and other programming languages have grammar rules that must be followed. We call that syntax.
Backus-Naur Form helps humans write in language that computers can interpret.
Expression is something that has a value. Python follows the grammatical structure of Arithmetic expressions is Expression Operator Expression
On to Stage 2: Work Session 1
1:36 pm
Pulled away again right after last post...Back on for another three hours of uninterrupted study time. Had to pick up The Revivalists new Album Men Amongst Mountains, first though. Just released yesterday. I've been listening to these guys nonstop and have to support them on their debut weekend.
Back to the Mighty Python...3:27 pm
Wrapped up 2.1 and the work session 1 with some syntax quizzes in Python. Moving on to 2.2 Variables and Strings
So, now we're talking about variables. A Variable is an assigned expression that can be changed.
An Assignment Statement i.e. Name = Expression, assigns an expression to a variable.
Moving on to strings. Strings can be printed using " " or ' ', double or single quotes. Strings can be concatenated with the operator +.
Strings can be sequenced using square brackets [].
Strings are 0-based so that the first letter begins at the number 0 and moves forward from there. For example:
name = JP
print name[0]
will print J
You can also print a range of letters using the colon : as in
print word[3:6] this will print the fourth to the sixth letters in the word. Remember, strings are 0-based so the first letter is counted as zero. Negative numbers can be used in the square brackets. Negative numbers count from the end of the string.
Words in strings can be found using the method .find.
string.find('word-in-string') will print the character at which the search term begins.
A return of -1 means that the string was not found.
Strings are case sensitive.
4:05 pm
More vocab:
Parameters are values or numbers that go inside parentheses. Parameters can help you find specific points within a string...in the case of finding strings. They have other uses too..Specifically with the .find method the first parameter will be a letter or phrase and the second parameter can be a number. This number tells the method at which character it should begin looking for the first parameter.
Wrapped up 2.2 looking at how these parameters effect strings.
4:17 pm
On to Stage 2: Work Session 2..
Apparently triple double or single quotes can be used to print multiple line strings. That's a new one for me.
Work session 2 involves some fun string .find-ing quizzes
5:02 pm
2.3 moves on to Functions (or procedures). I am constantly misspelling function...not good when working in object oriented programming.
Python functions are linked to the keyword "def" and "return" breaks the function and computes a result..parameters here are called inputs, sometimes parameters are also called operands.
I'm thinking that def stands for defined. So, function defined as...
syntax of a python function looks something like
def functionName(parameter):
return parameter do something
print functionName(value of parameter)
Finished up 2.3 and will go through the next work session before taking a short break.
5:41 pm
The final quiz begins walking your through the process of using Python to create HTML. This is going to be really cool, and it's a skill I can't wait to master. Absolutely brilliant to write a program to create more programs for you. I suppose, though, that this is the idea behind AI technology. Create the AI program and it can create on it's own...but that is for another course, and one that is available on Udacity, as a matter of fact. But that's all for me for about an hour or so.
5:57 pm