Introduction_to_CS___Topic_1__Python
Introduction_to_CS___Topic_1__Python
Topic 1: Python
Pham Minh Hoang
November 29, 2022
1
• List all virtual environments conda env list
2
2 Get started with Visual Studio Code
Visual Studio Code is a lightweight but powerful source code editor which runs on your
desktop and is available for Windows, macOS and Linux. It comes with built-in support
for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other
languages and runtimes (such as C++, C#, Java, Python, PHP, Go, .NET).
You can browse and install extensions from within VS Code. Extensions let you add
languages, debuggers, and tools to your installation to support your development workflow.
Installing a new extension by clicking on the Extensions icon in the Activity Bar on the left
side of VS Code or the choose menu View > Extensions To support Python programming,
you can install Python extension by open Extension, search Python, and install
3
To create a new Python script, select the folder, click the icon New File, and rename
your file ”hello.py”
4
3 Python programming
3.1 Variable
A variable can be declared by an assignment. Variables do not need to be declared with any
particular type, and can even change type after they have been set.
# a is assign to a integer
a = 1
# a is assigned to a string
a = " Hello ␣ world !"
3.2 List
Lists are used to store multiple items in a single variable. More details about list can be
found here and here
3.3 Function
A function is a block of code which only runs when it is called. You can pass data, known
as parameters, into a function. A function can return data as a result. More details about
function can be found here and here
3.4 If..else
More details about if/else can be found here
5
3.5 For loop
More details about for loop can be found here
References
[1] The OpenCV Tutorials