Integers: Basic arithmetic operations (+, -, *, /, %, //, **)
Floats: Same arithmetic operations as integers, Operations with integers and floats return floats
Strings: Concatenation with +, String formatting, Indexing and slicing, Common string methods (e.g., upper(), lower(), strip(), split(), join(), replace())
Lists: Indexing and slicing, Appending, extending, inserting, removing, and popping elements List comprehension, Common list methods (e.g., append(), extend(), insert(), remove(), pop(), index(), count())
Tuples:Indexing and slicing,Tuples are immutable, so they have fewer methods compared to lists
Dictionaries: Accessing, inserting, updating, and deleting key-value pairs, Iterating through keys, values, or items, Dictionary comprehension, Common dictionary methods (e.g., get(), keys(), values(), items(), pop(), popitem(), update())
Sets: Adding, removing, and updating elements, Set operations (union, intersection, difference, symmetric difference), Common set methods (e.g., add(), remove(), discard(), pop(), clear(), union(), intersection(), difference(), symmetric_difference())
'if' statements are used for conditional branching in Python. 'else' statement is used along with if to execute a block of code if the condition is false. 'elif' statement is used to check for multiple conditions after an if statement.
'for' loop is used to iterate over a sequence (such as a list, tuple, string, etc.). 'while' loop is used to execute a block of code repeatedly as long as a condition is true.
'break' statement is used to exit the loop prematurely. 'continue' statement is used to skip the rest of the code inside the loop for the current
Python supports a one-liner conditional expression for assigning values based on a condition.
Functions are essential building blocks in Python that allow you to organize and reuse code.
Parameters are placeholders for the values that a function needs to operate. Functions can have zero or more parameters. Parameters are specified inside the parentheses in the function definition.
Functions can optionally return a value using the return statement. The return statement exits the function and sends back a value to the caller.
Scope refers to the visibility of variables within a program. Python has local, enclosing, global, and built-in scopes. Variables defined inside a function are in the local scope and are only accessible within that function, Variables defined in the global scope are accessible throughout the entire program. If a variable is referenced inside a function but not defined there, Python will search for it in enclosing, global, and built-in scopes, in that order.
Python has several built-in exception types that represent different error conditions. Some common ones include TypeError, ValueError, ZeroDivisionError, IndexError, FileNotFoundError, KeyError, etc. You can also create your own custom exceptions by subclassing Exception or any other built-in exception.
The try-except block is used to catch and handle exceptions that may occur in your code.