Question 46
What is the output of Python set operations: 's1 = {1, 2, 3}; s2 = {3, 4, 5}; print(s1 & s2, s1 | s2)'?
& is set intersection (common elements {3}); | is set union ({1, 2, 3, 4, 5}).
What is the output of Python set operations: 's1 = {1, 2, 3}; s2 = {3, 4, 5}; print(s1 & s2, s1 | s2)'?
& is set intersection (common elements {3}); | is set union ({1, 2, 3, 4, 5}).
In Python, what is the purpose of the 'os.path.join(path1, path2)' function?
os.path.join ensures cross-platform file path compatibility across OS platforms.
Which function in Python's 'os' module returns a list containing the names of the entries in the directory given by path?
os.listdir(path) returns a list of file and directory names contained within the specified path.
In Python file operations, what does the 'shutil' module provide?
shutil.copy() and shutil.rmtree() handle high-level file system management.
In Python, what is the result of applying 'copy.deepcopy()' vs 'copy.copy()' on nested data structures?
deepcopy creates new compound objects and recursively inserts copies of objects found in the original.