Q. What is Python?
Ans. Python is a high-level, general-purpose programming language known for its readable syntax and wide range of applications.
Q. Who created Python?
Ans. Python was created by Guido van Rossum and first released in 1991.
Q. What are the main features of Python?
Ans. Python offers readable syntax, dynamic typing, a large standard library, portability, and support for multiple programming styles.
Q. What is an interpreter in Python?
Ans. The Python interpreter executes Python programs by processing their instructions through the Python runtime.
Q. What is a variable in Python?
Ans. A variable is a name that refers to an object or value in a Python program.
Q. How do you display output in Python?
Ans. The print() function displays text and other values on the standard output.
Q. How do you take user input in Python?
Ans. The input() function reads a line of text entered by the user and returns it as a string.
Q. What are the basic data types in Python?
Ans. Common built-in types include int, float, str, bool, list, tuple, dict, and set.
Q. What is indentation in Python?
Ans. Indentation is the leading whitespace used to define code blocks in Python.
Q. What is a comment in Python?
Ans. A comment is explanatory text ignored by the Python interpreter as executable code. A # symbol starts a single-line comment.
Q. What is a conditional statement?
Ans. A conditional statement such as if, elif, or else selects which code block executes according to a condition.
Q. What is a loop in Python?
Ans. A loop repeatedly executes a block of code. Python provides for and while loops.
Q. What is a function in Python?
Ans. A function is a reusable block of code defined with def or another supported function syntax.
Q. What is a list in Python?
Ans. A list is an ordered, mutable collection that can contain elements of different types.
Q. What is a tuple in Python?
Ans. A tuple is an ordered collection that cannot have its elements reassigned through ordinary item assignment after creation.
Q. What is a dictionary in Python?
Ans. A dictionary stores key-value pairs and allows values to be retrieved using keys.
Q. What is the difference between = and == in Python?
Ans. The = operator assigns a value to a target, while == compares two values for equality.
Q. What is a module in Python?
Ans. A module is a Python file or supported module object containing definitions and statements that can be imported.
Q. What is exception handling in Python?
Ans. Exception handling uses constructs such as try and except to respond to runtime errors or other exceptions.
Q. What is the purpose of the range() function?
Ans. The range() function produces an immutable sequence of integers commonly used for iteration in loops.