Explore our extensive collection of questions and answers to enhance your learning experience and prepare for exams effectively
lambda x, y: x + y (2, 3) defines and calls a function returning 2 + 3 = 5.
The import keyword includes a module, e.g., import math.
from math import sqrt imports only the sqrt function from the math module.
math.sqrt(25) returns 5, the square root of 25.
dir() lists all attributes and methods of a module, e.g., dir(math).
A function without return implicitly returns None.
*args collects arguments, so multiply(2, 3) returns 2 * 3 = 6.
type() returns the type, e.g., type(5) returns .
The default parameter ‘Guest’ is used, returning ‘Hello Guest’.
sorted() returns a new sorted list, e.g., sorted([3, 1, 2]) = [1, 2, 3].