Python Basics
1
Training
30-Minute Study Material with Examples & Exercises
CADD TRAINING CENTRE (M) SDN BHD
2 Agenda
- Introduction to Python
- Variables & Data Types
- Control Structures
- Functions
- Lists & Dictionaries
- Simple Exercises
CADD TRAINING CENTRE (M) SDN BHD
3 Introduction to Python
• Python is an interpreted, high-level programming
language.
• Easy to learn and widely used in data science, AI,
web development.
• Open-source and cross-platform.
CADD TRAINING CENTRE (M) SDN BHD
4 Variables & Data Types
Examples:
name = 'Alice'
age = 25
height = 5.6
is_student = True
Common Data Types:
- int, float, str, bool, list, dict
CADD TRAINING CENTRE (M) SDN BHD
5 Control Structures
if-else statements
for loops
while loops
Example:
for i in range(5):
print(i)
CADD TRAINING CENTRE (M) SDN BHD
6 Functions
Functions are reusable blocks of code.
Example:
def greet(name):
return f'Hello {name}'
print(greet('Alice'))
CADD TRAINING CENTRE (M) SDN BHD
7 Lists & Dictionaries
Lists:
numbers = [1,2,3,4]
Dictionaries:
student = {'name':'Alice','age':25}
print(numbers[0])
print(student['name'])
CADD TRAINING CENTRE (M) SDN BHD
8 Exercises
1. Create a variable 'x' with value 10 and print it.
2. Write a loop to print numbers from 1 to 10.
3. Write a function that takes 2 numbers and returns
their sum.
4. Create a list of 5 fruits and print the 2nd fruit.
5. Create a dictionary with keys: name, age, course.
CADD TRAINING CENTRE (M) SDN BHD
9
Q&A
10
THANK YOU