What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'} for x in d.values(): print(d[x])
0 1 2
a b c
0 a 1 b 2 c
none of the mentioned
d = {0, 1, 2} for x in d.values(): print(x)
None None None
error
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
What will be the output of the following Python code snippet?
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
example = "snow world" example[3] = 's' print (example)
snow
snow world
Error
snos world
print(max("what are you"))
u
t
y
example = "helle" print(example.find("e"))
-1
1
0
example = "NITIN" print(example.rfind("N"))
4
3
print("abc DEF".capitalize())
abc def
ABC DEF
Abc def
Abc Def
print("xyyzxyzxzxyy".count('yy', 1))
2
print("xyyzxyzxzxyy".count('xyy', 2, 11))
print("xyyzxyzxzxyy".count('xyy', -10, -1))
print("xyyzxyzxzxyy".endswith("xyy"))
True
print("xyyzxyzxzxyy".endswith("xyy", 0, 2))
False