Computer Setup and Programming Introduction
Setup
Setting up your computer to work with a programming language is also known as "setting up your environment."
Installing Python
There are multiple options for installing Python on both Macintosh and Windows operating systems. INLS 560-003 students are encouraged to use the download option at python.org.
We will confirm whether or not you have Python 3 installed. If not, we will visit Python.org and download and install, or upgrade your version of Python 3. This link will work for both Windows or Mac Users.
Need Slides? | OS | Details |
---|---|---|
Windows | If you are a Windows user, don't attempt to check your Python version via the Command prompt or Powershell because you will be prompted to download the version from the Microsoft Store, even if you have downloaded and installed Python from python.org. After download and install, you will need to locate the python terminal app and run python from that app, not the Command Prompt or Powershell. | |
Mac | After you install from python.org you will open your terminal app and type in python3 to verify installation. |
Installing a Python IDE
The most popular IDE for editing Python files is Visual Studio Code.
I have read through multiple books and watched multiple online courses, and up-to-date sources (2023) uniformly use Visual Studio Code.
You can get it here for either Windows or Mac. After you download it, we will need to install the Python plugin files. I will also demonstrate PyCharm. I really like PyCharm but it is not open-source and it seems to run out of memory and then require memory setting changes. Therefore, I have decided to use Visual Studio Code. It would not hurt to download both and give each a try.
❌ Jupyter Notebooks
We will not be using Jupyter Notebooks. Please do not submit Jupyter notebook files for INLS 560 assignments.
Python Interpreter
We will start out on the command line with the python interpreter.
# Items we will do on Command Line Interface (CLI)
'''
mac: open an terminal if you are on a mac and enter python3
Windows: open Python app and you will be ready to go
>>>
Pseudocode: informal language that is not meant to be compiled or executed
print hello world!
enter 8 + 4 to use the interpreter as a calculator
enter 8 / 0 to intentionally make an error
enter 8 / 3 to get a decimal number (float)
enter 5 // 2 to get a truncated remainder
enter: help() ----> will put you in help> utility
enter: keywords
enter: quit to leave help
enter help('keywords') for quick help on a topic and stay out of help> utility
help(keywords) will throw an error if you leave out quotation marks
'''
Programming Introduction
Everything in this class that we will learn is keyed to the Gaddis text. These pages on this SILS class lesson site are notes and items related to the online book. For full text and extras for a section item, you simply need to log into the online book and find the section number. If you come back to notes page later, and you need more context, log into the online book and review that section.
1.1 Overview
Key terms: program, programming, developer, coder, software, language, coding
1.2a Hardware
Key terms: hardware, components, CPU, memory, storage, RAM, SSD, drives, input device, output device
1.2b Software
Key terms: system software, application software, OS, utility program, application software.
1.3 Storing Data
All data that is stored in a computer is converted to sequences of 0s and 1s.
Key terms: binary data, bit: binary digit, bits, byte, bytes, binary number, switch metaphor, bit pattern, character, ASCII, Unicode, two's complement, floating-point notation, digital data, pixels
1.4 Computer Languages
A computer’s CPU can only understand instructions that are written in machine language. Because people find it very difficult to write entire programs in machine language, other programming languages have been invented.
Key terms: machine language(0101101), instruction set, fetch-decode-execute cycle, assembly language(mov, mul), assembler, low-level language, high-level language, key words or reserved words
Specific Languages
See Table 1-1 in the Gaddis Text for an overview of these languages. Follow any link for more in-depth information.
Ada, BASIC, Fortran, COBOL, PASCAL, C, C++, C#, Java, JavaScript, Python, Ruby, Visual Basic
More Key terms: operators, syntax, statements, compiler, interpreter, source code, syntax error (humans understand syntax errors; compilers and interpreters do not)
1.5 Coding and Programming with Python
Python Key words
and, or, not, true, false, if, else, elif, del, from, None, as, global, nonlocal, try, assert, while, break, except, import, with, class, in, pass, yield, continue, finally, is, raise, def, for, lambda