INTRODUCTION TO PYTHON :
· Python be a high-level , interpreted programming language know for it simplicity , readability , and versatility .
· Guido van Rossum create Python in the late 1980s , with the first version release in 1991 .
· Python emphasize code readability and use indentation to define code block instead of curly brace or keywords .
· It support multiple programming paradigm , include procedural , object-oriented , and functional programming .
· Python ‘s extensive standard library and vast ecosystem of third-party package make it suitable for various application , from web development to scientific computing .
VARIABLES :
· Variables in Python be container use to store data value .
· Variables be create when they be assign a value use the assignment operator (=).
· Variable name must follow certain rule : they can contain letter , digit , and underscore , but can not start with a digit .
· Python variable be dynamically type , mean they can hold value of any data type and their data type can change during execution .
· Naming variable descriptively improve code readability and understanding .
COMMENTS :
· Comments in Python be annotation use to explain code functionality and purpose .
· They be ignore by the Python interpreter and be intend for human reader .
· Comments begin with the hash character ( # ) and can appear on a line by themselves or at the end of a line of code .
· Writing clear , concise comment help in code documentation , maintenance , and collaboration .
· Good commenting practice enhance code readability and facilitate debugging and troubleshooting .
NUMERIC DATA TYPES :
· Python support various numeric data type , include integer ( int ) , floating-point number ( float ) , and complex number (complex)
· Integers represent whole number without fractional part .
· Floating-point number represent real number with a decimal point .
· Complex number consist of a real and an imaginary part .
· Python provide arithmetic operator for perform mathematical operation on numeric data type , such a addition , subtraction , multiplication , division , and exponentiation .
SEQUENCE DATA TYPES :
· Sequences in Python be ordered collection of item index by integer .
· Common sequence data type include string , list , and tuples .
· Strings represent sequence of character enclose in single or double quote .
· Lists be mutable sequence of item enclose in square bracket , allow modification after creation .
· Tuples be immutable sequence of item enclose in parenthesis , mean they can not be modify after creation .
SET AND DICTIONARY :
· Sets be unordered collection of unique item enclose in curly brace , useful for store distinct element .
· Dictionaries be key-value pair enclose in curly brace , enable efficient data retrieval base on key .
· Sets do not allow duplicate element and support operation like union , intersection , and difference .
· Dictionaries facilitate fast data access and manipulation through key-value pair and be use for map relationship between item .
NONE TYPE :
· None be a special data type in Python represent the absence of a value .
· It be use to signify miss or undefined value in situation where a value be expect but not available .
· None be distinct from False and 0 and do not support any special operation .
· It is commonly use to initialize variable , represent default value , or indicate the absence of a return value from a function .
OPERATORS :
· Operators in Python be symbol use to perform specific mathematical or logical operation on value .
· Arithmetic operator perform basic arithmetic operation like addition , subtraction , multiplication , division , and exponentiation .
· Relational operator compare the value of operand and determine the relationship between them .
· Assignment operator assign value to variable or modify their exist value .
· Logical operator perform logical operation like AND , OR , and NOT on boolean value .
EXPRESSIONS :
· Expressions in Python be combination of constant , variable , and operator that evaluate to a value .
· Precedence of operator determine the order in which operation be perform in an expression .
· Parentheses can be use to override operator precedence and control the order of evaluation .
· Understanding expression and operator precedence be crucial for write correct and efficient Python code .
STATEMENTS :
· Statements in Python be unit of code that the interpreter can execute .
· Assignment statement be use to assign value to variable . Print statement be use to display output to the console .
· Statements must follow Python ‘s syntax rule to be interpret and execute correctly .
INPUT AND OUTPUT :
· Python ‘s input ( ) function be use to prompt the user for input and accept data from the keyboard .
· The input ( ) function return a string value , which can be convert to other data type a need .
· The print ( ) function be use to display output to the console .
· Strings , number , and other data type can be concatenate or format within print statement to produce desired output .
TYPE CONVERSION :
· Type conversion involve change the data type of a variable from one type to another .
· Explicit type conversion , or type casting , be perform use built-in function like int ( ) , float ( ) , and str ( ) .
· Implicit type conversion , or coercion , occur automatically when perform operation between different data type .
· Understanding type conversion be essential for manipulate data and perform operation on variable of different type .
DEBUGGING :
· Debugging be the process of identify and fix error or bug in a program .
· Common type of error include syntax error , logical error , and runtime error .
· Syntax error be detect by the interpreter during code compilation and prevent program execution .
· Logical error produce incorrect result but do not halt program execution , make them hard to detect .
· Runtime error occur during program execution and result in abnormal termination due to invalid operation or condition .
· Debugging technique include read error message , use print statement , and systematically test code to identify and resolve issue .