Lab01 Installation
Lab01 Installation
Lab01
Introduction
Missions:
1. Install the tools required for this subject.
2. Explore basic Windows Command Prompt (CMD) commands.
In order for the computer to understand Python programming language, you need to
download the Python interpreter.
You can download the latest Python version from the official website.
To open the Command Prompt to test Python installation, click on the Windows Button at the
bottom left of your screen and type “cmd”. You should see “Command Prompt” after you
typed. Click it to open.
Visual Studio Code (VS Code in short) is a free code editor developed by Microsoft, which
runs on Windows, Linux, and macOS operating systems. It supports multiple programming
languages. According to the Stack Overflow’s Annual Developer Survey 2019, VS Code is
the most popular development environment used among the 90,000 developers surveyed.
The following are the installation instructions for Windows. For macOS machine, check out
this official tutorial.
KWBAN (William) 1
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
4. Click the “Next >” button without making any changes if you want to use the default
settings for “Select Destination Location” and “Select Start Menu Folder”.
5. For “Select Additional Tasks”, check the two “Add ‘Open with Code’ action …”
checkboxes as shown in the figure below. With these, we can open a file with VS Code
by right-clicking the file. Notice that the “Add to PATH …” checkbox is checked by
default. This allows us to open VS Code from Command Prompt or Powershell.
KWBAN (William) 2
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
In the unlikely event where your computer configuration does not meet the system
requirements, you may consider using Notepad++.
Notepad++ is one of the free, simplest, and hassle-free code editors available for Windows
and Linux operating systems. While Notepad++ is more lightweight than VS Code, it
certainly lacks many features that VS Code provides (e.g. smart code completion, direct
debugging, etc.)
You may still find Notepad++ useful even though you can install VS Code in your computer,
because Notepad++ starts up much faster than VS Code. This is very handy if you just want
to check out raw contents of a file quickly (e.g. image, executable, PDF, etc) to verify the
true format of the file.
For this subject, Notepad++ is optional, so you may choose to install it by following the
instructions below, or skip to the next exercise.
Instructions
To download the latest Notepad++ installer, check out the official website.
Once the installer is downloaded, run the installer to install Notepad++. Click on the “OK”
button.
Click on “Next”, “I Agree” and many times of “Next” again to install Notepad++.
KWBAN (William) 3
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
KWBAN (William) 4
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
Try the following practical exercises to gain familiarity with the Command Prompt
commands.
[Note: The following exercise is for Command Prompt in Windows. For macOS Bash
Terminal, you can do the following exercise by referring to this documentation]
The following activities will demonstrate how you can view the contents of your
folder/directory in Command Prompt. Windows uses a new term called folders whereas the
original Command Prompt uses the term directory. Both terms will be interchangeably use
but would have the same meaning in this course. Try this section exercises on C drive (i.e.
C:).
(a) dir: Try out this command and make a mental note of what you see on your screen.
dir/w
KWBAN (William) 5
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
(b) Similarly try out this command and see if there is any difference to output.
dir/p
B. Creating Directories
In Command Prompt, you would be allowed to create directories to store your files in the
future. Directories are provided to allow you to group similar files together for easy search
and reference. Directories comprise of main directory also known as the root directory and
subdirectories.
Creating a directory
For example the command: mkdir PSP0101 will create a directory called PSP0101.
KWBAN (William) 6
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
Creating a sub-directory
To create a sub-directory you would first have to navigate to the directory that you have
created and then issue the same command (mkdir) but with a new directory name. For
example if you are already in the root and you wish to navigate to the newly created
directory in your directory PSP0101. To do so issue the following command: cd PSP0101
The command cd indicates to Command Prompt that you would like to change directory to
PSP0101.
Next, do a dir and confirm that you have successfully traversed to the desired directory. If
you are in the directory PSP0101, you should be able to see the following prompt, C:\
PSP0101 >. At this prompt, issue the following command: mkdir notes
This will effectively create a subdirectory within the directory PSP0101 that is called notes.
Confirm the successful creation of this directory by issuing the dir command. Command
Prompt uses a tree structure to main its directory.
KWBAN (William) 7
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
If you are deep in a subdirectory and wishes to quickly return to the root directory, simple
issue the following command: cd\
Copying Files
One of the functions that is allowed in all operating systems is the ability to copy files.
Moving files is considered a basic function that is provided by Command Prompt. There are
two ways to copy files. One is to specify the absolute path of the source file and the
destination of the files to be copied. Another way is to use the relative path method.
KWBAN (William) 8
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
Example:
Task: Try to copy any file from other path in your computer to C:\PSP0101\notes folder.
Example:
KWBAN (William) 9
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
Renaming files
Files that are stored in your folder can be renamed to anything you desire. But take note that
these files might already have associated applications with them so be wise in renaming
files.
Example:
KWBAN (William) 10
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
Example:
KWBAN (William) 11
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design
(c) Directory names can also be renamed by using the command rename in similar fashion.
For the complete documentation of Windows CMD commands, check out this link.
KWBAN (William) 12