What does the following code output? from itertools import islice g = (x**2 for x in range(100)) print(list(islice(g, 4))) Python DeveloperMedium Try Now
What is the output of the following? x = {1, 2, 3} & {2, 3, 4} print(x) Python DeveloperMedium Try Now
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