Python uses indentation rather than braces to indicate blocks of code. Statements typically end with a new line, but the line continuation character allows continuing a line. Blank lines and lines with only whitespace or comments are ignored. Semicolons allow multiple statements per line if no new block is started. Standard data types include numbers, strings, lists, tuples, and dictionaries. Numbers can be integers, floats, or complexes. Strings use quotes, lists use brackets, tuples are like read-only lists, and dictionaries are hash tables. Data type conversion functions allow changing between types.
Python uses indentation rather than braces to indicate blocks of code. Statements typically end with a new line, but the line continuation character allows continuing a line. Blank lines and lines with only whitespace or comments are ignored. Semicolons allow multiple statements per line if no new block is started. Standard data types include numbers, strings, lists, tuples, and dictionaries. Numbers can be integers, floats, or complexes. Strings use quotes, lists use brackets, tuples are like read-only lists, and dictionaries are hash tables. Data type conversion functions allow changing between types.
• Python does not use braces({}) to indicate blocks of code for class and function definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly enforced. Multi-Line Statements • Statements in Python typically end with a new line. Python, however, allows the use of the line continuation character (\) to denote that the line should continue Quotation in Python • Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as the same type of quote starts and ends the string Using Blank Lines • A line containing only whitespace, possibly with a comment, is known as a blank line and Python totally ignores it. Multiple Statements on a Single Line • The semicolon ( ; ) allows multiple statements on a single line given that no statement starts a new code block. Multiple Statement Groups as Suites • Groups of individual statements, which make a single code block are called suites in Python. Standard Data Types Python has five standard data types- • Numbers • String • List • Tuple • Dictionary Python Numbers • Number data types store numeric values. Number objects are created when you assign a value to them. • Python supports three different numerical types − • int (signed integers) • float (floating point real values) • complex (complex numbers) Python Strings • Strings in Python are identified as a contiguous set of characters represented in the quotation marks. Python Lists • Lists are the most versatile of Python's compound data types. A list contains items separated by commas and enclosed within square brackets ([]). Python Tuples • A tuple is another sequence data type that is similar to the list. Tuples can be thought of as read-only lists. Python Dictionary • Python's dictionaries are kind of hash-table type. Data Type Conversion • Sometimes, you may need to perform conversions between the built-in types. To convert between types, you simply use the type- name as a function.