Questions and Answers Already Passed
What is the purpose of the `print()` function in Python?
✔✔It outputs data to the console or terminal.
How do you create a variable in Python?
✔✔By assigning a value to a name using the equals sign (`=`).
What is the difference between a list and a tuple in Python?
✔✔A list is mutable (can be changed), while a tuple is immutable (cannot be changed).
How do you add an item to a list in Python?
✔✔Using the `append()` method.
What is a dictionary in Python?
✔✔A collection of key-value pairs, where each key is unique.
1
, What does the `len()` function do in Python?
✔✔It returns the number of items in an object such as a list, tuple, or string.
How do you define a function in Python?
✔✔Using the `def` keyword followed by the function name and parentheses.
What is the purpose of a `for` loop in Python?
✔✔To iterate over a sequence (like a list, tuple, or string) and perform an action for each item.
How do you check the data type of a variable in Python?
✔✔Using the `type()` function.
What is the difference between `==` and `=` in Python?
✔✔`==` is a comparison operator that checks equality, while `=` is an assignment operator.
What is the purpose of the `input()` function in Python?
✔✔It allows the user to input data via the console.
2