Welcome to CSCI 1301
Computer Science I
• Congratulations on your participation in this
Python programming class!
• Python is one of the most popular programming languages in
the job market.
• Learning Python can open up numerous opportunities in
various fields.
• One of the tasks for our Week 1 is to install VS Code and
Python.
VS Code and Python
• This video is extremely helpful. Play and stop often to
allow yourself time to follow. You may replay it a few
times to allow the concepts to sink:
Python Tutorial for Beginners with VS Code 🐍 (youtube.com)
• The video is for both Windows and Mac computers.
• Don’t be afraid to try – you will not break anything!
VS Code and Python
• Step 1: Download Python
Go to: python.org to download Python
VS Code and Python
• Step 2: After downloading, install Python.
MUST select
this!!!
VS Code and Python
• Step 3: Download and install Visual Studio Code (VS Code).
• VS Code is a programming environment that allows you to write
programs and run them.
Download Visual Studio Code - Mac, Linux, Windows
VS Code and Python
• After successful installation of VS Code, go to your
computer, create a folder that you will use to store your
programs in the future.
• For example, I created a folder called CSCI_1301\Codes
• Open VS Code
VS Code and Python
• Step 4: Add your work folder to VS Code
• Open VS Code, and close the Welcome window. Then click Explore icon to
add your folder.
VS Code and Python
• Step 5: Link Python with VS Code
• Click the Extensions icon
• In Search bar, type Python. Choose and install Python (Python language
support by Microsoft)
VS Code and Python
• Step 6: Choose an interpreter for your command window.
• Push: Ctrl Shift P
• Choose Python Interpreter
VS Code and Python
• Step 7: Finally, you can open a terminal window, and verify
Python is correctly installed and linked with VS Code.
• Go to the Menu bar, choose Terminal, New Terminal
• In the terminal window, type: py - --version. If it gives information
as shown below, it is working!
Python
• You can use VS Code
Terminal to run
Python
interactively.
• In the example, I
assigned a string
‘Hello world!’ to a
varible called msg.
• I then used a Python
command print to
display the content
in msg.
• In the Interactive
mode, you can run
your commands and
see the results.
• To get out of the
interactive mode,
Python
• To write and
run a Python
program (a .py
file), follow
these steps.
1.Push Ctrl N at
the same time to
start an editor
window.
2.In the editor
window, type
your commands.
3.Save the file as
a Python program
file. Your file
will be saved as
a .py file.
Python
• To run the .py file, there are two ways in VS Code.
1.Use the triangular Run button in VS Code
as shown in the small red circle here
OR
2.In the terminal window, type
py hello.py
behind the …CSCI_1301\Codes>
and hit the return/enter on keyboard