0% found this document useful (0 votes)
3 views12 pages

Lab01 Installation

This document provides a comprehensive guide to setting up the necessary tools for the PSP0101 - Problem Solving and Program Design course, including the installation of Python and Visual Studio Code. It also covers basic Windows Command Prompt commands for file and directory management, including creating, copying, and renaming files and directories. Additionally, it offers optional instructions for installing Notepad++ as a lightweight code editor.

Uploaded by

muqhreezdanysh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views12 pages

Lab01 Installation

This document provides a comprehensive guide to setting up the necessary tools for the PSP0101 - Problem Solving and Program Design course, including the installation of Python and Visual Studio Code. It also covers basic Windows Command Prompt commands for file and directory management, including creating, copying, and renaming files and directories. Additionally, it offers optional instructions for installing Notepad++ as a lightweight code editor.

Uploaded by

muqhreezdanysh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design

Lab01
Introduction

Missions:
1. Install the tools required for this subject.
2. Explore basic Windows Command Prompt (CMD) commands.

Installing Python Interpreter


Python is the programming language used for this subject (not the scary giant snake!).

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.

Then, follow the installation steps in this link.

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.

Installing Visual Studio Code


To write programs, we need code editors that are designed for such task.

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.

1. Download the Visual Studio Code Installer for Windows.

2. Once it is downloaded, run the installer (VSCodeUserSetup-{version}.exe).

3. Accept the license agreement.

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.

6. Click the “Install” button to complete the installation.

KWBAN (William) 2
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design

[Optional] Installing Notepad++


VS Code is lightweight and should run on most available hardware and platform versions.
You can review the System Requirements to check if your computer configuration is
supported.

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

Command Line Exercises


The command line is a quick, powerful, text-based interface developers use to more
effectively and efficiently communicate with computers to accomplish a wider set of tasks.
Learning how to use it will allow you to discover all that your computer is capable of!

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]

A. Display contents of a directory

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

To create a directory, issue the following command: mkdir <directory name>.

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

Navigating the directory

To return to the top directory, simply issue the command: cd ..


(cd with two full stops).

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

Copying a single file


The following command enables files to be copied.
Copy <source drive:\pathname\filename.ext> <destination drive:\pathname\filename.ext>

Example:

copy D:\Text\myfile.txt C:\PSP0101\notes\myfile.txt

Task: Try to copy any file from other path in your computer to C:\PSP0101\notes folder.

Copying multiple files


Instead of specifying the exact filenames you may use wildcards * to copy multiple files.

Example:

copy D:\Text\*.txt C:\PSP0101

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.

(a) Renaming files by copying


You may rename files by using the copy command by specifying a different destination
file name in the copy command.

Example:

copy D:\Text\myfile.txt C:\PSP0101\notes\apple.txt

KWBAN (William) 10
Trimester 1, 2020/21 PSP0101 - Problem Solving and Program Design

(b) Using the Rename Command


Another way to rename files is by using the rename command. For example if you wish
to rename a file called apple.txt to pear.txt simply type the following command :

Example:

rename apple.txt pear.txt

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.

CMD Commands Documentation

For the complete documentation of Windows CMD commands, check out this link.

KWBAN (William) 12

You might also like