Define Python.
A high-level, interpreted programming language known for its readability and versatility.
What does PEP stand for?
Python Enhancement Proposal, a design document providing information to the Python community.
True or false: Python is a compiled language.
FALSE
Python is primarily an interpreted language.
Fill in the blank: Python uses _______ for defining blocks of code.
Indentation
What is a list in Python?
A mutable, ordered collection of items, defined using square brackets.
Define tuple.
An immutable, ordered collection of items, defined using parentheses.
What is the purpose of lambda functions?
To create small, anonymous functions at runtime.
True or false: Lists can contain different data types.
TRUE
Fill in the blank: The main function in Python is defined using _______.
if __name__ == ‘__main__’:
What is a dictionary in Python?
A mutable, unordered collection of key-value pairs, defined using curly braces.
Define set.
An unordered collection of unique items, defined using curly braces.
What does the len() function do?
Returns the number of items in an object.
True or false: Strings in Python are mutable.
FALSE
Strings are immutable; they cannot be changed after creation.
Fill in the blank: The for loop in Python iterates over _______.
iterable objects
What is exception handling?
A method to handle errors gracefully using try and except blocks.
Define module.
A file containing Python code that can be imported into other Python programs.
What is the purpose of the import statement?
To include external modules or libraries in a Python program.
True or false: Python supports object-oriented programming.
TRUE
Fill in the blank: A class in Python is defined using the _______ keyword.
class
What is a constructor in Python?
A special method called when an object is created, usually named __init__.
Define inheritance.
A mechanism where a new class derives properties from an existing class.
What is polymorphism?
The ability to use a single interface to represent different data types.
True or false: Python uses static typing.
FALSE
Python uses dynamic typing, meaning variable types are determined at runtime.
Fill in the blank: A list comprehension is a concise way to create _______.
lists