Which of the following is the correct way to handle multiple exception types in a single except clause? Python DeveloperMedium Try Now
What is the output of the following? a = [1, 2, 3] print(a[-1], a[-2:]) Python DeveloperMedium Try Now
What is the difference between deep copy and shallow copy for nested structures in Python? Python DeveloperMedium Try Now
What is the output of the following? print(sorted([3,1,4,1,5], key=lambda x: -x)) Python DeveloperMedium Try Now
What is the output of the following? d = {‘a’: 1, ‘b’: 2} d2 = {**d, ‘b’: 99, ‘c’: 3} print(d2) Python DeveloperMedium Try Now
What does the zip() function do when iterables of different lengths are passed? Python DeveloperMedium Try Now
What is the output of the following? try: x = 1 / 0 except ZeroDivisionError: x = -1 finally: print(x) Python DeveloperMedium Try Now
What is the output of the following? from functools import reduce result = reduce(lambda acc, x: acc + x, [1, 2, 3, 4], 10) print(result) Python DeveloperMedium Try Now
What is the output of the following? def gen(): yield from range(3) print(list(gen())) Python DeveloperMedium Try Now