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
error
none of the mentioned
x = 2 for i in range(x): x += 1 print (x)
0 1 2 3 4 …
3 4
0
What will be the output of the following Python code?
for i in range(5): if i == 5: break else: print(i) else: print("Here")
0 1 2 3 4 Here
0 1 2 3 4 5 Here
0 1 2 3 4
1 2 3 4 5
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])
+
*
-
All of the mentioned
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
example = "helle" print(example.rfind("e"))
4
3
What will be the output of the following Python statement?
print(chr(ord('A')+32))
A
B
a
print(chr(ord('b')+1))
b
c
2
print("abc DEF".capitalize())
abc def
ABC DEF
Abc def
Abc Def
print("xyyzxyzxzxyy".count('yy'))
print("xyyzxyzxzxyy".count('yy', 1))
print("xyyzxyzxzxyy".count('xyy', 2, 11))