Introduction

Timeline of Programming Languages
The timeline starts with Plankalkül in 1942 and ends with Swift in 2014. What has been developed since that time?

In this module you'll Explore the history of programming languages, how to use the textbook and Python resources, install the Python language, install Visual Studio Code (an Integraded Development Environment (IDE)), update its settings and preferences, discover how write a simple program to submit in Canvas, and respond to the scoring feedback.

Languages

Programmers use a variety of languages and tools to create apps. To see what some of what web developers use, right-click on this textbook page and choose View Source or Dev Tools > View source. You'll see the Hypertext Markup Languge (HTML) and a link to a Stylesheet, which is called a Cascading Stylesheet (CSS). These languages build the front-end of a website, which controls the structure of content displaying in a browser, such as the text, heading heirarchy, data lists, data tables, imagery, audio, video, and hyperlinking.

Stylesheets are used to control the visual representation of that marked-up content. It defines their placement, spacing, fonts, sizes, colors, navigation design, and animations.

Interative and dynamic components can be added using a language like JavaScript, which has many libraries of code to improve the user experience. It can help control the front-end components as well as interact dynamically with the backend features, such as relational data. What you don't see is PHP...the language that interacts with the server to provide efficiencies behind the scenes. Python is similar to PHP, inthat it communicates with the web server to improve efficiency and interaction between the user and content/data.

Instead of Python, many develpers use PHP, Ruby, Go/Golang, Java, or .Net to serve data and calculations to the browser's front-end.

What is Programming?

To understand the vocabulary common among computer programmers, view the following videos. Take notes to help aid retention as well as *star concepts to review in class.

The First Programming Languages: Crash Course Computer Science #11.
Operating Systems: Crash Course Computer Science #18.

Install Python

The Python Interpreter

Read about how to use the Python language on your computer or in the cloud. Install the most appropriate version of the language, depending on your system version:

Upgrade to version 3+

So that we can take advantage of Python add-ons/modules in the future, you may need to update your computer's version of Python. For example, MacOS cames installed with version 2 or higher, but version 3.10 is avaiable now.

In the VS Code Terminal, type python --version to see what version you have working.

To update, review options at Python 3.10.6 and follow instructions there to make the update.

After checking VS Code's terminal and your computer's terminal, the older, previous version is printed, which would imply the software installation is incomplete. If that is the case for you, then Follow instructions at the HitchKiker's Guide to Python:

Install an Editor

1. Install Visual Studio Code

VS Code logo VS Code is (free) so you can write programs in files, make commands via a terminal/console, and add extensions to improve complexity.

After clicking the link to VS Code, your platform will be detected automatically and show in the blue Download button. Use the down arrow to view the list of options, and click the Stable download icon to launch the installation for your platform. Once installation is complete, add the VS Code application icon to your Mac Dock or Windows Taskbar.

2. Choose a Theme and Font Size

The VS Code app comes with a default dark theme, which may or may not be easy on your eyes. If you prefer other levels of contrast and color combinations, try out the built-in themes and/or install and enable others via the Extensions menu. Screenshots in this tutorial are using the Gruvbox Concoctis Light Medium theme from wheredoesyourmindgo.

  1. From the Code > Preferences > Color Theme menu. Select from the Dark, Light, and High-Contrast themes listed. Leave on the one you like the best.
  2. From the Code > Settings menu, search for font size and change it to 14 (or a size that suits your eyes best).
  3. From the Settings menu, search for auto save and set the afterDelay feature to 1000 (or whatever timing you prefer).
  4. Come back to this area later to update text-editing conventions that you prefer, such syntax highlighting, folding, hover/hints, tab size, word-wrap, disable minimap, etc.
  5. Learn more: VS Code shortcuts and tricks that I wish I knew sooner.

3. Add Extensions

Click the Extensions icon on the left menu bar and add the following extensions:

  1. Python
  2. A theme that improves readability (optional)

4. Create a workspace

Use the VS Code File Explorer to make folders and files.
Use the VS Code File Explorer to make folders and files.

You can create folders and files for a project (called a Workspace) in a variety of ways.

Choose an interpreter

VS Code will need a Python Interpretor to run Python 3, and it will ask you to choose one. This prompt will be located on the bottom colored bar, typically in blue or gold with a warning triangle.
Find the prompt below the terminal.

Click it, or use Shiftp or cntrlShiftp to select an interpretor: Python: Select Interpreter then choose the Python Version 3.8.2 64-bit option.
Command-Shift-p or Control-Shift-p to select the interpreter.

The version selected will then show up in blue below the terminal, like this:
The Interpreter version will be located below the terminal window.

Terminal Command Line

Your computer is installed with an application that allows you to type commands to tell it what to do, such as navigate through folders and files, Create, Read, Update, and Delete folders and file (CRUD), and change the permissions of folders and files to increase or decrease security. It can also be used to install libraries/dependencies, run your apps/sites, view console log output, debug problems, and run multiple terminals at once.

For this course, you'll use Python in the VS Code Terminal to give your assignments some commands.

Terminal windows in VS Code can be accessed in these ways:

  1. From the Terminal menu → New Terminal.
  2. With the Control tilde buttons: ^ ~ keystroke.
  3. By dragging up from the bottom of a file editing window.
  4. From the File Explorer, right-click on a file/folder and choose Open in Integrated Terminal.

Close the running terminals at the end of each working session using Cntrlc, so they don't interfere with the next day's work.

Use the terminal to type commands and view print statements.
Use the terminal to type commands and view print statements.

Debugging

The Terminal's Problems tab provides the number of coding issues in the tab and lists them below. Click it to view their line numbers.

The Terminal's Debug Console tab automatically provides support for Python. To use it:

  1. Click the Run Debug icon on the left menu.
  2. Click the Run and Debug button.
  3. Choose the language (Python) from the dropdown list.
  4. View the Debug Console or Problems tab in the Terminal. If the debug messages are too vague, consider adding related extensions or methods.
View a list of coding problems in the Problems tab.
View a list of coding problems in the Problems tab. The list disappears as you fix issues.

Share your Code in Zoom Help Sessions

When sharing your Code during Zoom Help Sessions, set up your screen so the Instructor or TA can quickly assess your output and code:

  1. Place the browser window (localhost) on the left ⅓ of the screen.
  2. Place the VSCode window showing your code on the right ⅔ of the screen.
  3. From the Code > Settings menu, search for font size and change it to 14, or use + (Mac) or Ctrl+ (Win) to increase the font size from the keyboard.
Overlap the browser instructions and/or output with VS Code's window to speed up communications in Help Sessions.
Overlap the browser instructions and/or output with VS Code's window to speed up communications in Help Sessions.

Read Think Python

Read through Think Python's Chapter 1. General Introduction:

In-class Activity

In small groups, collaborate in a Google Sheet or Excel file named "Python Concept Reference Sheet" and add the names, definitions, and examples of the different programming language concepts.

Also include a column to describe what the new term reminds you of. If it reminds you of something from personal experience, nature, math, or other programming languages, etc., list that concept. For example, if you know some JavaScript, list the name of the same concept.

Concept Description Example Reminds me of...
       

Here are terms to understand from Chapter 1 of the textbook:

Share your file

To share the new spreadsheet file with your group mates, use the following procedure:

Write Program 1

Set up workspace folders using your File Explorer/Finder, or VS Code's Folder icon.
Set up workspace folders using your File Explorer/Finder, or VS Code's Folder icon. You can also use the terminal, but it requires memorization of directory paths on your hard drive.
  1. Create a new workspace folder (using one of the methods in the Install VS Code tab).
  2. In that folder, add folders for 10 modules.
  3. In the first module's folder, make a new file named p1-username-goals.py. Replace 'username' with your ONID username.
  4. In the file, write commands in Python to do the following:
    1. Comment your first and last name and the date.
    2. Comment the name of this assignment "Programming Goals".
    3. Comment and Print a paragraph that explains the reason you have taken this course and what you hope to get out of it.
    4. Comment and Print the result of a calculation of a set of numbers using addition, subtraction, multiplication, and division.
  5. Save the file using cntls or s.
  6. Run the program using one of these methods:
    • Click the run arrow ▶ at the top right of the editing screen.
    • In the terminal, type: python p1-username-goals.py
    • Right-click on the file in the file list (or from in the file) and choose Run Python file in terminal.
  7. Backup your work to a cloud drive and/or USB stick drive.

Submit Program 1

Zip the .py file and upload it to the Module > Assignment in Canvas. The Instructor/TA will download the zip archive and run your .py file to score it.

Respond to Feedback

Within 3 days of your submission, check the CanvasGrades area to view your score in the Rubric, along with our feedback.

Respond to the feedback if you have questions, by replying in the GradesAssignmentComment box.