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

summary python

ពាក្យគន្លឹះ

Summary Python Programing

I.            Overview of Variables

A variable serves as a named storage location in memory to store and manage data dynamically during execution. In Python, variables are defined using the assignment operator (⁠=⁠). Key attributes include: 

1. Dynamic Typing: Types are automatically inferred at runtime without explicit declaration. 
2. Core Data Types: Integers (
⁠int⁠), Floating-point numbers (⁠float⁠), Strings (⁠str⁠), Booleans (⁠bool⁠), Lists (⁠list⁠), Tuples (⁠tuple⁠), Dictionaries (⁠dict⁠), Sets (⁠set⁠), and ⁠NoneType⁠. 
3. Naming Conventions: Variable names are case-sensitive and must conform to style standards such as PEP 8 (e.g., cannot begin with a number).
 

II.            Basic Operations in Python

Operations allow programs to manipulate values and control program flow. Python supports five main categories of basic operations: 

1. Arithmetic Operations: Standard math operations including addition (⁠+⁠), subtraction (⁠-⁠), multiplication (⁠*⁠), standard division (⁠/⁠), floor division (⁠//⁠), modulus (⁠%⁠), and exponentiation (⁠**⁠). 
2. Assignment Operations: Basic assignment (
⁠=⁠) and in-place compound assignments (⁠+=⁠, ⁠-=⁠, ⁠*=⁠, ⁠/=⁠). 
3. Comparison Operations: Relational checks returning Boolean outcomes, such as equality (
⁠==⁠), inequality (⁠!=⁠), greater than (⁠>⁠), and less than or equal to (⁠<=⁠). 
4. Logical Operations: Boolean logic operators
⁠and⁠, ⁠or⁠, and ⁠not⁠. 
5. Membership Operations: Operators
⁠in⁠ and ⁠not in⁠ used to verify if a element exists within a sequence. 

III.            String Manipulation

Strings are sequences of characters used to handle text. Essential operations and methods discussed include: 

1. Concatenation & Formatting: Joining text using ⁠+⁠ or dynamically embedding variables using f-strings (⁠f"..."⁠). 
2. Indexing & Slicing: Finding the length via
⁠len()⁠, retrieving single characters via index (e.g., ⁠text[0]⁠), or extracting sub-strings via slicing (⁠text[start:end]⁠). 
3. Built-in String Methods: Changing case (
⁠.upper()⁠, ⁠.lower()⁠), stripping leading/trailing whitespace (⁠.strip()⁠), replacing substrings (⁠.replace()⁠), counting occurrences (⁠.count()⁠), and splitting sentences into lists (⁠.split()⁠).

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