Introduction to Python
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability. Python uses significant indentation to define code blocks, and it supports multiple programming paradigms, including object-oriented, procedural, and functional programming.
Python is dynamically typed and garbage-collected. It supports a wide range of databases, including SQLite, MySQL, PostgreSQL, and Oracle.
Core Concepts
Data Types
Python offers several built-in data types, including integers, floating-point numbers, strings, lists, dictionaries, and tuples.
- Integers: Whole numbers (e.g., 10, -5, 0)
- Floats: Decimal numbers (e.g., 3.14, -2.5)
- Strings: Sequences of characters (e.g., "Hello, World!")
- Lists: Ordered, mutable sequences of items enclosed in square brackets [ ].
- Dictionaries: Collections of key-value pairs enclosed in curly braces { }.
- Tuples: Ordered, immutable sequences of items enclosed in parentheses ( ).
Control Flow
Python supports control flow statements like if-else statements and for/while loops for executing code based on conditions and iterating over sequences.