លំហសិក្សាកម្ពុជា លំហសិក្សាកម្ពុជា V1.0
ចូល ចុះឈ្មោះ

Summary Lesson 1

មូលសង្ខេប / Abstract

A summary of Lesson 1 covering the basics of blockchain technology

ពាក្យគន្លឹះ

Python Programming Basics – Week 2

 

This week, I learned the basic concepts of Python programming and practiced them in VS Code. I learned how to select the Python interpreter (Python 3.14.7), run a Python file, and see the result in the Terminal.

 

1. Variables and Data Types

A variable is a named storage location in memory that keeps information or data for later use. A variable has a name, value, type, memory location, scope, and mutability. Python is dynamically typed, so the type is automatically determined by the value assigned to the variable. Variable names can start with a letter or underscore, but cannot start with a number. Python is case-sensitive, so myVar and myvar are different. Variables can have local or global scope. Common types are Integer (int) for whole numbers, Float (float) for decimal numbers, String (str) for text, Boolean (bool) for True or False, and None for no value.

 

2. Data Structures and Indexing

I learned four main data structures:

  • List [ ] – ordered and can be changed
  • Tuple ( ) – ordered but cannot be changed
  • Dictionary { } – stores key-value pairs
  • Set { } – stores unique elements

I also learned indexing. Forward indexing starts from 0, while backward indexing starts from -1, -2, -3, and so on.

 

3. Basic Operations

I practiced five types of operations in VS Code:

  • Arithmetic: +, -, *, /, //, %, **
  • Assignment: =, +=, -=, *=, /=
  • Comparison: ==, !=, <, >, <=, >=
  • Logical: and, or, not
  • Membership: in, not in

These operations help perform calculations, assign and update values, compare values, combine conditions, and check whether an item exists in a data structure. Many comparison and logical operations return a Boolean value (True or False).

 

4. String Manipulation

String manipulation means working with text in Python. I practiced the following:

  1. Concatenation (+) – joining two or more strings together.
  2. String formatting – using f-strings or .format() to insert variables into text.
  3. Length (len()) – finding the number of characters in a string.
  4. Indexing – accessing individual characters using an index, starting from 0.
  5. Slicing – getting part of a string using [start:stop:step].
  6. Conversion – using .upper() and .lower() to change letter cases.
  7. Stripping whitespace (.strip()) – removing spaces from the beginning and end of a string.
  8. Replacing (.replace()) – replacing one part of a string with another.
  9. Checking substrings (in) – checking whether specific text exists in a string.
  10. Splitting (.split()) – separating a string into different items.

I also practiced using both single quotes ' ' and double quotes " " for strings. I learned that an f-string needs the f before the string to format variables directly; otherwise, the text is printed as it is.

 

5. My VS Code Practice

I practiced these concepts by writing Python code in VS Code and running it through the Python interpreter. I tested arithmetic calculations, assignment, comparison, logical and membership operations, data structures, indexing, and all the main string manipulation methods. The results appeared in the Terminal, which helped me understand how the code works in practice.

 

Here is the link of my real practice: Initital commit of my Python practice file

 

 

summary lesson 1.pdf
PDF ឯកសារ
ទាញយក អាន
ចែករំលែក
រក្សាទុក
ការផ្សព្វផ្សាយ
ការផ្សព្វផ្សាយ
មតិយោបល់ 0
ចូលគណនី ដើម្បីបញ្ចេញមតិ