Q2_Solutions
Q2_Solutions
A Frame in Tkinter is a container widget used for grouping and organizing other widgets like buttons,
It acts as a rectangular area that can include child widgets and is commonly used to divide a GUI
Frames also support custom styling, such as background color, border width, and dimensions.
Example:
root = Tk()
frame.pack(padx=10, pady=10)
root.mainloop()
In this example, the Frame is styled with a blue background, border, and specific dimensions.
---
b) Explain function arguments in detail:
Functions in Python accept inputs known as arguments, which allow customization and flexibility.
order-independent.
4. Variable-length Arguments: Use *args for multiple positional arguments and **kwargs for multiple
keyword arguments.
Example:
print(args, kwargs)
---
Python dictionaries have various built-in functions to handle key-value pairs effectively. Three
Example:
d = {'a': 1, 'b': 2}
Example:
3. items(): Returns key-value pairs as tuples inside a view object. Useful for looping.
Example:
These functions simplify dictionary operations like data retrieval and iteration.
---
To display the current date, the datetime module in Python is used. It provides classes for
Program:
current_date = date.today()
print("Current Date:", current_date)
Explanation:
This makes date handling versatile for applications like calendars or logs.
---
An anonymous function, also called a lambda function, is a one-line, inline function in Python. It is
Example:
# Example usage