Please enable JavaScript.
Coggle requires JavaScript to display documents.
PCEP Python Cirtificate Entry Program - Coggle Diagram
PCEP
Python Cirtificate Entry Program
Chapter 1:
Computer Programming & Python Fundamentals
(18%)
1.1. Understand fundamental terms and definitions
Python is an INTERPRETED languague
Interpreting:
the source code is executed line by line by the interpreter. The code can be run as is without any pre-compilation
Interpreter
: is the program the directly reads and executes the code. In the case of python, this is "python.exe". Compilation of the code happens at runtime.
Three Elements of language:
Lexis:
define the dictionaries the word that we're using
Syntax:
that define our word order and the extra elements of the language, the punctuation
Semantics
: that make sure every thing that we putting together makes sense
1.2. Understand Python's logic and structure
Keyword:
the reserved words in Python that have specific meaning and purposes. They are part of the language's syntax and cannot be used as variable names, names or identifiers.
Instructions
: are individual commands or statements in Python that perform specific actions when executed. They include operation such as assignments, function calls, loops and conditional statements.
Indentation
: To maintain a clean and organized code structure, Python relies on indentation to group simple instructions into larger code blocks. While other languages often use curly braces for this purpose, Python use White space alone. Indentation should be done using spaces, not tabs, so if you prefer using tab key, make sure your editor convert tab to space automatically.
Four spaces is recommended.
Comments
: are lines in the code that are ignored by the Python interpreter. They are used to add explanations, notes, or descriptions for other developers (or your self) to understand what the code does
Triple quotes (""") is using for docstring in functions, class and modules to describe their purpose and usage.
1.3. Introduce literals and variables into code and use different number system
- Boolean :
True or False. Raise "NameError" if not define right name
- Int:
whole number without decimal place. Two integer is added, it make an new integer.
- Float:
the number with the decimal place.
Scientifc Notation:
when the numbers are incredible big or incredibly small, us humans struggle to find the correct value to name the numbers This is where scientific notation helps:
String
is a single or multiple characters.
Use double or single quote pairs to mark text as a string and not an object name. You can use single or double quotes but be consistent. Using triple quotes , you can create multi-line strings
Working with String
String methods
lower()
upper()
title(): he beginning character of each word is uppercase
String concatenation
Using (+) sign to concate two string
String multiplication
Using (*) case to multiple any charcter
Number Format
Binary
Decimal
Hexadecimal
Octal
Variable
Variable are reference to object.
If objects are immutable ( int, string, tuple) : change value will create new reference
If object are mutable (list, ): modifying a list does not create new reference ( or modifying a list will modify the reference)
Naming Conventions
'- Variable must be start with Underscore(_) or letter
Perform Input/Output console opeartions
1.4. Choose operators and data-types adequate to the problem
Numberic Operations
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Exponentiation (**) : số mũ
Modulo (%): chia lấy phần dư
Floor Division (//) : chia lấy phần nguyên (return the integer part smaller than or equal to the actual number)
Brackets (): control order of evaluation
Assignment and Shortcut Operators
Assignment : x = 5
Adds & assign: x+=3
PEMDAS
rule:
Parentheses ()
Exponents (**)
Multiplication (*) or Division (/)
Addition (+) or Subtraction (-)