Python Daily Quiz (PythonDQ)

Joined May 2024
2 Photos and videos
5 Sep 2024
Improve this Bubble Sort Algorithm: @mjovanc
111
5 Sep 2024
Improve this Bubble Sort Algorithm
1
2
9
2,523
21 Jul 2024
What is output of following Python Code? num = 15 if num % 2 == 0: print("Even") else: print("Odd") a) Even b) Odd c) Error d) No output
6
11
2,127
20 Jul 2024
What is the output of the Python code? x = 20 if x < 10: print("Less than 10") elif x < 20: print("Less than 20") elif x < 30: print("Less than 30") else: print("30 or more") a) Less than 10 b) Less than 20 c) Less than 30 d) 30 or more
15
3
19
3,704
19 Jul 2024
What is output of the Python code? y = 8 if y > 10: print("y is greater than 10") elif y < 10 and y > 5: print("y is between 5 and 10") else: print("y is 5 or less") a) y is greater than 10 b) y is between 5 and 10 c) y is 5 or less d) Error
19
1
14
2,694
18 Jul 2024
What is the output of the Python code? x = 10 if x > 5: print("x is greater than 5") elif x == 10: print("x is 10") else: print("x is less than or equal to 5") a) x is greater than 5 b) x is 10 c) x is less than or equal to 5 d) No output
12
11
2,409
17 Jul 2024
Output of following Python code? my_dict = {'a': 1, 'b': 2, 'c': 3} new_dict = {} for key in my_dict: new_dict[key] = my_dict[key] ** 2 print(new_dict) a) {'a': 1, 'b': 4, 'c': 9} b) {'a': 1, 'b': 2, 'c': 3} c) {'a': 2, 'b': 3, 'c': 4} d) {'a': 1, 'b': 2, 'c': 3, 'd': 4}
6
1
7
708
16 Jul 2024
What will be the output of the following Python code and why? dict = {'a': 1, 'b': 2, 'c': 3} print(1 in dict) a) True b) False c) None d) Error
3
5
917
15 Jul 2024
dict = {'a': 1, 'b': 2, 'c': 3} for value in dict.values(): print(value, end=' ') a) 1 2 3 b) a b c c) {'a': 1, 'b': 2, 'c': 3} d) None
5
1
11
1,520
14 Jul 2024
What will be the output of the following Python code? my_dict = {'a': 1, 'b': 2, 'c': 3} for key in my_dict: print(key, end=' ') print() a) a b c b) 1 2 3 c) a: 1 b: 2 c: 3 d) a b c 1 2 3
7
2
9
2,091
13 Jul 2024
What will be the output of the following Python code? my_dict = {'a': 1, 'b': 2, 'c': 3} for key, value in my_dict.items(): if value % 2 == 0: print(key) a) a b) b c) c d) a, c
10
2
8
2,414
12 Jul 2024
What will be the output of the following Python code? s = {1, 2, 3, 4} print(sum(s)) a) 10 b) 4 c) An error message d) None of the above
4
1
8
1,779
11 Jul 2024
What will be the output of the following Python code? s = {1, 2, 3, 4} for i in range(5): if i in s: continue else: print(i) a) 0 b) 4 c) 0, 4 d) No output
6
7
1,218
9 Jul 2024
In Python, which of the following set operations is equivalent to set1.difference(set2)? a) set1 - set2 b) set1 | set2 c) set1 & set2 d) set1 ^ set2
4
1
9
662
9 Jul 2024
What will be the output of the following Python code? s1 = {1, 2, 3, 4, 5} s2 = {4, 5, 6, 7, 8} print(len(s1 | s2)) a) 5 b) 8 c) 10 d) 13
6
2
10
1,555
8 Jul 2024
What will be the output of the following Python code? s1 = {1, 2, 3, 4} s2 = {3, 4, 5, 6} print(s1.intersection(s2)) a) {1, 2} b) {3, 4} c) {5, 6} d) Error
10
2
17
2,694
7 Jul 2024
What will be the output of the following Python code? s1 = {1, 2, 3, 4} s2 = {3, 4, 5, 6} print(s1.issuperset(s2)) a) True b) False c) Error d) None
3
7
858