Objectives:

-Continue developing python skills.
-Understand importance of coding in a greater world context .


This week we will be covering Python to a greater extent. We must ensure our skills are up to par in order to begin using the PI and to begin our upcoming projects. Coding is a central part of computing. Our goal is to have you feel comfortable enough in your skills to be able to jump into other types of programing or continue mastering Python long after this course is over. For a little motivation, let’s hear from a random selection of techies and celebrities why they think coding is important:

Python, A Programming Language

By now you should have a general idea as to what a programming language is. Although we may not understand all the ways in which a program written by humans gets translated by the computer, it is still important to keep understanding what a program is and what it can do.
So let us backtrack. What is a program?
Let us read this excerpt from Jeffrey Elkner’s book, Beginning Python Programming for Aspiring Web Developers, 
 

“The programming language you will be learning is Python. Python is an example of a high-level language; other high-level languages you might have heard of are C++, PHP, and Java.

As you might infer from the name high-level language, there are also low-level languages, sometimes referred to as machine languages or assembly languages. Loosely speaking, computers can only execute programs written in low-level languages. Thus, programs written in a high-level language have to be processed before they can run. This extra processing takes some time, which is a small disadvantage of high-level languages.

But the advantages are enormous. First, it is much easier to program in a high-level language. Programs written in a high-level language take less time to write, they are shorter and easier to read, and they are more likely to be correct. Second, high-level languages are portable, meaning that they can run on different kinds of computers with few or no modifications. Low-level programs can run on only one kind of computer and have to be rewritten to run on another.

Due to these advantages, almost all programs today are written in high-level languages. Low-level languages are used only for a few specialized applications requiring exact control of the computer.

Two kinds of programs process high-level languages into low-level languages: interpreters and compilers. An interpreter reads a high-level program and executes it, meaning that it does what the program says. It processes the program a little at a time, alternately reading lines and performing computations.

A compiler reads the program and translates it completely before the program starts running. In this case, the high-level program is called the source code, and the translated program is called the object code or the executable. Once a program is compiled, you can execute it repeatedly without further translation.

Many modern languages use both processes. They are first compiled into a lower level language, called byte code, and then interpreted by a program called a virtual machine. Python uses both processes, but because of the way programmers interact with it, it is usually considered an interpreted language. “

On to the Basics of Code: 

The Variable:

A variable is a value that we can both assign and change, depending on conditions specified within the program. The process of assigning variables is usually called “declaring”.
Variables can hold different data types.Each data type prescribes and limits the form of the data. Examples of data types include: an integer expressed as a decimal number, or a string of text characters, or a boolean.

The Boolean:

A boolean is a data type that comes set with two values, true or false. It plays a major role in conditional statements, which allow different actions and change “control flow” depending on whether a programmer-specified Boolean condition evaluates to true or false.

Strings:

A string is just a sequence of characters put in quotation marks.

Control Flow:

Control flow simply refers to the order in which statementsinstructions or function calls of a program are executed.

Conditionals:

Conditional statements are features of a programming language which perform different computations or actions depending on whether our boolean condition evaluates to true or false.

Comparators:

Comparators check if a value is (or is not) equal to, greater than (or equal to), or less than (or equal to) another value.

Boolean Operators:

Boolean Operators are used to connect and define the relationship between your values. They basically act like comparators, only using words instead of symbols. (AND, NOT, OR)
A little more in depth to the Boolean: At the binary level, Boolean logic can be used to describe electromagnetically charged memory locations or circuit states that are either charged (1 or true) or not charged (0 or false). The computer can use an AND gate or an OR gate operation to obtain a result that can be used for further processing. (i.e. booleans ultimately determine flow of electromagnetic charge)

Resources to Continue Coding: 

Although we will only be covering Python in this course, there are plenty of other resources for you available on line to learn other programming languages. Here are a few I suggest you link into outside of class:
CodeAcademy: This is one of my favorites available on the internet and you have already become familiar with it from your HW assignments. They offer courses in HTML, Javascript, and more. Each course lasts a matter of hours and are designed so you can do it on your own. Don’t forget about the forums in case you get stuck on a problem!
Code.org: This website is a central hub for self-taught coders. They offer you courses straight from the website and lead you into other neat resources online. Click on the “Code Studio” to check out one of their 20 hour crash courses in computer science.
Coursera: This one is a bit more general and might appeal to those “love to learn” types out there. Coursera offers courses in just about any subject you can think of, including programming, and their lessons stem from accredited universities around the world. Note that certain courses do cost money.

Homework Assignment: 

 
We need to keep practicing Python! Please complete the following lessons as well as their mini-projects in Code Academy:
“Functions”
“Lists and Dictionaries”

Submission: In order to get credit for this assignment, please send me the link to your CodeAcademy profile in your submission e-mail. This way I can track your progress. This can be done by clicking on “View My Profile” in the upper right hand corner and then just copying and pasting the link in the adress bar. Your link should look like this:

  • “https://www.codecademy.com/name_of_your_account”