PythonDQ (@PythonDQ) profile picture

Python Daily Quiz (PythonDQ)

x.com
Joined May 2024
Photo by PythonDQ (@PythonDQ)Photo by PythonDQ (@PythonDQ)
Replying to @512x512
Improve Grok by adding audio and video to Grok's responses. If user asks Grok to teach them how to sous vide a 5 pound prime rib roast, Grok returns step-by-step instructions via text and via video with audio. Audible, visual, and readable instructions help. @512x512 @elonmusk
1
18
Improve this Bubble Sort Algorithm: @mjovanc
114
Improve this Bubble Sort Algorithm
1
2
7
2,524
Replying to @itsmeivoo
Clear and concise communication in both writing and speaking.
23
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
1
10
2,129
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
14
3
19
3,704
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
18
1
14
2,694
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
11
1
10
2,409
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
709
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
4
918
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
10
1,521
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
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
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
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,219
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