What will be the output of the following Python expression?
x=24//6%3, 24//4//2 print(x)
(1,3)
(0,3)
(1,0)
(3,1)
What will be the output of the following Python code?
x = ['ab', 'cd'] for i in x: i.upper() print(x)
[‘ab’, ‘cd’]
[‘AB’, ‘CD’]
[None, None]
none of the mentioned
x = "abcdef" i = "a" while i in x: x = x[:-1] print(i, end = " ")
i i i i i i
a a a a a a
a a a a a
x = "abcdef" i = "a" while i in x[:-1]: print(i, end = " ")
a a a a a a … infinite Time
a
x = "abcdef" i = "a" while i in x: x = x[1:] print(i, end = " ")
no output
error
x = 'abcd' for i in x: print(i) x.upper()
a B C D
a b c d
A B C D
What will be the output of the following Python code snippet?
x = 'abcd' for i in range(len(x)): x[i].upper() print (x)
abcd
ABCD
d = {0: 'a', 1: 'b', 2: 'c'} for i in d: print(i)
0 1 2
a b c
0 a 1 b 2 c
d = {0: 'a', 1: 'b', 2: 'c'} for x, y in d.items(): print(x, y)
Option A
Option B
Option C
Option D
d = {0: 'a', 1: 'b', 2: 'c'} for x in d.keys(): print(d[x])
d = {0: 'a', 1: 'b', 2: 'c'} for x in d.values(): print(x)
d = {0, 1, 2} for x in d.values(): print(x)
None None None
d = {0, 1, 2} for x in d: print(x)
{0, 1, 2} {0, 1, 2} {0, 1, 2}
d = {0, 1, 2} for x in d: print(d.add(x))
0 1 2 0 1 2 0 1 2 …
None of the mentioned
for i in [1, 2, 3, 4][::-1]: print (i)
1 2 3 4
4 3 2 1
string = "my name is x" for i in string: print (i, end=", ")
m, y, , n, a, m, e, , i, s, , x,
m, y, , n, a, m, e, , i, s, , x
my, name, is, x,
string = "my name is x" for i in string.split(): print (i, end=", ")
a = [0, 1, 2, 3] for a[-1] in a: print(a[-1])
0 1 2 3
0 1 2 2
3 3 3 3
a = [0, 1, 2, 3] for a[0] in a: print(a[0])
str1="helloworld" print(str1[::-1])
dlrowolleh
hello
world
helloworld