0% found this document useful (0 votes)
7 views34 pages

Introduction to Python Programming Basics

The document is an introduction to computing with a focus on Python programming, covering topics such as the Python IDE, basic commands, and language execution comparisons. It emphasizes the importance of Python due to its ease of learning and widespread use in various industries. Additionally, it discusses different methods for running Python, both online and offline, and provides examples of basic Python code.

Uploaded by

Ín Nki
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)
7 views34 pages

Introduction to Python Programming Basics

The document is an introduction to computing with a focus on Python programming, covering topics such as the Python IDE, basic commands, and language execution comparisons. It emphasizes the importance of Python due to its ease of learning and widespread use in various industries. Additionally, it discusses different methods for running Python, both online and offline, and provides examples of basic Python code.

Uploaded by

Ín Nki
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

Introduction to Computing (IS086IU)

Chapter 1
Overview & Introduction to Computing
Nguyen Minh Thien

2025 – 2026

1
Overview
• Introduction
• Python Integrated Development Environment (IDE)
• First Python Code
• Basic Python Commands
• Language Execution Comparison

2
Why Study Computing?

3
Programmers (in nature) 4
Computer Hardware

Source: google images

5
Where are you?

6
Understanding Programming
How did you learn Vietnamese as a little kid?
1. Learn vocabulary and the grammar.
2. Learn to spell the words
3. Construct well-formed “sentences”.

4. To “tell a story, you combine words


and sentences to convey an idea to the reader.

There is a skill and art in constructing the story, and skill in


story writing is improved by doing some writing and getting
some feedback. In programming, our program is the “story”
and the problem you are trying to solve is the “idea”.
7
Why Python?
• Easy to learn and read
• English-like syntax:
for name in names:
print(“Hello ”, name)
• Popularly used tool in the world
• Google’s official programming
language
• Facebook (Instagram, data analysis)
• Netflix (data analysis, ML,
recommendation system)
• Amazon (cloud services, ML)
• IBM, Microsoft, NASA, YouTube,
LinkedIn, Reddit, etc

8
Why Python? Area Popular Libraries

Data Analysis Pandas, NumPy, Dask


• Large libraries
Machine Learning Scikit-learn,
• Used by: TensorFlow, PyTorch
• Engineers for simulations
• Scientists for data analysis Deep Learning Keras, Transformers
• Economists for modeling
Visualization Matplotlib, Seaborn
• Artists for generative design
• Teachers for educational tools Web Development Flask, Django
• Massive community support:
• Stack Overflow: Python Q&A Automation Shutil, os, Selenium
• Python conferences,
online courses Scientific Computing SciPy, OpenCV

9
Running Python: Online vs. Offline
Offline (on your PC) Online (on Browsers)

Installation required No install – Runs in browser

Best for real development, large Best for quick experiments,


projects, offline learning teaching, coding on mobile
Tools available like Official Google Colab, JupyterLite, and
Python Installer, Anaconda, and Kaggle Notebooks, etc
Visual Studio Code, etc
Fast speed Depends on internet/server

Ideal for developers, engineers, Students, teachers, casual users


serious learners
10
Official Python Installer (Offline)
• Website: [Link]

• Open-source (Python Software Foundation License)


• Supports Windows, MacOS, and Linux
• The standard way to install Python
• NOT ideal for beginners, who may find the installation process confusing
due to its multiple steps and configuration options
11
Anaconda with Spyder & Jupyter (Offline)
• Anaconda Distribution:
[Link]
• Free and open-source
• Windows, MacOS, and Linux
• Supports Python and R languages
• Widely used in data science, machine
learning (ML), and research
environments

12
Visual Studio Code with Python Extension
• Website:
[Link]
• Free and open-source
(MIT License)
• Developed by Microsoft for
Windows, MacOS, and Linux
• Supports Python, C++, Java
JavaScript, HTML, etc
• Widely used code editor worldwide, known for its support of multiple
programming languages and lots of useful add-ons
13
Running Python Offline
Official Python Anaconda Visual Studio Code
Installer (Spyder + Jupyter) (VS Code)
• Beginners • Data scientists, researcher • Developer, general coder
• Very small size • Very large • Small to medium
• Txt editor • Spyder, Jupyter • VS editor
• No Jupyter support • Buit-in • Via extension
• Fast speed • Quite heavy • Fast
• Easiest, cleanest way to • Perfect for data analysis, • Powerful editor for
install and run Python machine learning general software
• Great for learning basiss, • Comes with all major development
scripts, and quick testing libraries (NumPy, Pandas, • One editor for every
PyTorch, Matplotlib, etc) programming languages
14
JupyterLab (Online)
• Website:
[Link]
• BSD 3-Clause License:
• Open-source
• Permissive (allows reuse, modification,
distribution)
• Browser-based (works on any OS)
• No login required
• Supports Python, R, and others
• Growing fast for teaching, offline
demos (not rely on the internet)
15
Google Colab (Online)
• Google Colaboratory:
[Link]
• Free and hosted by Google, not fully
open-source
• Browser-based (works on any OS)
• Login required
• Supports Python with GPU/TPU
options
• Extremely popular in ML, education,
and quick experiments

16
Kaggle Notebooks (Online)
• Website:
[Link]
• Free (requires Kaggle/Google
login account)
• Browser-based (works on any OS)
• Supports Python and R
• Widely used for real-world
competitions, data analysis, and
other notebook tasks
17
Running Python Online
JupyterLab Google Colab Kaggle Notebooks
• Local or self-hosted (can • Cloud-hosted by Google • Kaggle Cloud
be offline)
• No login required • Google account required • Account login required
• Package installation may • Downsides like session • Session limits, some UI
be confused for beginners timeouts, limited RAM not working
• Computer power limited • GPU/TPU available for • Free GPU with some
to your local PC free tier limits
• Browser local files only • Accesses files on Google • Kaggle Datasets or upload
Drive
• Best for teaching, demos • Best for ML project with • Best for data competitions
without login GPU (real-world challenges)
18
More Python Running Tools?

19
Get familiar with Google Colab
• Write several sample codes
• Run and observe results

20
First Python Code

• Open your IDE, create a new file: .py .ipynb

• Make a Python code. Ex: (no indent)

print(“Hello, World!”)

• Run your code by clicking the “Run” button

• What do you expect to happen?

21
Basic Python Commands
Code Result
# This is a single-line comment
"""
This is a multi-line comment.
"""
name = “Welcome to Python programming”
print(name) Welcome to Python programming
x = 5
y = 3.5
z = “hello”
print(type(x)) <class ‘int’>
print(type(y)) <class ‘float’>
print(type(z)) <class ‘str’>

22
String
Code Result
x = “HELLO”
print(x) HELLO
print([Link]()) hello
print(x[0].lower()) h
print(x[-1]) O
print(x[0:4]) HELL
print(x[:4]) HELL
print(x[2:]) LLO

print(“Z” in x) False
print(“H” in x) True
print(“h” in x) False

23
Code Result
X = “ABCDEFG”
# Python is case-sensitive
x = “Hello”
print(x) Hello
print(X) ABCDEFG
# Find the location of an element in X
print([Link](“D”) 3 String
# Output = -1 means the string does not
contain that element
Function
print([Link](“K”) -1
# Add “,” to large numbers
number = 1000000
print(number) 1000000
print(“{0:,}”.format(number)) 1,000,000
print(“{0:,}”.format(1000000000000000)) 1,000,000,000,000,000

24
List
Code Result
# Define a list
name = [“IU”, “EE”, “AC”]
print(name[-2] + “ ” + name[0]) EE IU
print(len(name)) 3

name[0] = “IU-VNU-HCMC”
print(name[-2] + “ ” + name[0]) EE IU-VNU-HCMC
print(type(name)) <class ‘list’>

list_1 = list(range(0, 10, 2))


print(list_1) [0, 2, 4, 6, 8]

25
List – Indexing
Code Result
nums = [40, 20, 10, 20]
print([Link](40)) 0
print([Link](20)) 1

print(nums[2]) 10
print(nums[-3]) 20
print(nums[:2]) [40, 20]

print(max(nums)) 40
print(min(nums)) 10
print(sum(nums)) 90
[Link]()
print(nums) [10, 20, 20, 40]

26
List – Operation
Code Result
a = [‘Mon’, ‘Tue’, ‘Wed’, ‘Thr’, ‘Fri’,
‘Sat’, ‘Sun’]
print(a) [‘Mon’, ‘Tue’, ‘Wed’, ‘Thr’, ‘Fri’,
‘Sat’, ‘Sun’]
print(a[2:5]) [‘Wed’, ‘Thr’, ‘Fri’]
# [start-num : end-num : step]
print(a[::2]) [‘Mon’, ‘Wed’, ‘Fri’, ‘Sun’]
list_1 = [‘Hello’, ‘Good Bye’]*3
print(list_1) [‘Hello’, ‘Good Bye’, ‘Hello’, ‘Good
Bye’,‘Hello’, ‘Good Bye’]
list_2 = a + list_1
print(list_2) [‘Mon’, ‘Tue’, ‘Wed’, ‘Thr’, ‘Fri’,
‘Sat’, ‘Sun’, ‘Hello’, ‘Good Bye’,
‘Hello’, ‘Good Bye’,‘Hello’, ‘Good
Bye’]

27
How Python Executes Your Code?
1. Reads your code line by line (in .py file) to check if the syntax is
correct
• Syntax: “Python grammar” like English grammar
2. Translates the code into bytecode, a low-level language
Python Code Bytecode
x = 1 + 2 1 0 LOAD_CONST 1 (1)
print(x) 2 LOAD_CONST 2 (2)
4 BINARY_ADD
6 STORE_NAME 0 (x)

2 8 LOAD_NAME 0 (x)
10 PRINT_EXPR
12 LOAD_CONST 0 (None)
14 RETURN_VALUE
28
High-level Language Slower

Faster

Examples
•Ex: Matlab, Python, C/C++, JavaScript, etc
•Definition: Easy for humans to read and write
•Characteristics:
•Platform-independent, easier to write, maintain, and debug
•Abstracts away hardware details like memory
management.
•Slower execution compared to lower-level languages
•Use: Web development, business applications, artificial
intelligence, scientific computing, and general-purpose software. 29
Assembly Languages
High-level Language Slower

Assembly Language
Faster

Examples
•Definition: Close to machine code but slightly easier for
humans to understand.
•Characteristics:
•Provides more control over hardware and system
resources.
•Can be optimized for performance-critical tasks, like
writing device drivers or real-time systems.
•Use: Situations where hardware control is crucial, such as in
embedded systems or operating systems. 30
High-level Language Slower

Assembly Language
Machine Languages
Machine Language Faster

•Definition: The lowest level of programming languages,

Examples
consisting of binary code (1s and 0s) that the computer’s
hardware can directly execute.
•Characteristics:
•Directly executed by the CPU.
•Machine-specific: Programs written for one type of CPU
will not work on another without modification.
•Difficult to read, write, and maintain for humans.
•Use: Writing extremely high-performance software where
every byte matters, or when interacting directly with hardware. 31
Language Execution Comparison
Intermediate
Language Compilation Type Runtime Engine Ease of Use Speed
Code

Assembled to
Assembly None None (runs on hardware) Very hard Fastest
machine code

Compiled to
C++ None None (native binary) Harder Very fast
machine code

Compiled to .class
Java JVM (Java Virtual Machine) Moderate Fast
bytecode bytecode

Interpreted + PVM (Python Virtual


Python .pyc bytecode Very easy Slower
bytecode Machine)

Why shouldn't low-level programming languages be left in the museum?


32
CUDA programming Python programming

33
Thanks for listening!

34

You might also like