Python Revision Guide
Python Revision Guide
1. What is Python?
Python is a high-level programming language known for its simplicity, readability, and versatility.
It is used in various fields such as web development, data science, automation, artificial intelligence,
and more.
2. List vs Tuple
Example:
def greet(name):
- `extend()` adds each element of an iterable (like a list) to the end of the list.
Example:
l = [1, 2]
l.append(3) # l = [1, 2, 3]
print(item)
- `is` checks if two objects refer to the same memory location (identity).
Example:
a = [1, 2]
b=a
print(a == b) # True
try:
x=1/0
except ZeroDivisionError:
You can create a function that accepts multiple arguments by defining them inside the parentheses:
Example:
greet("Sandesh", "Python")