31. What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]
for a[0] in a:
print(a[0])
a = [0, 1, 2, 3]
for a[0] in a:
print(a[0])
32. 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")
for i in range(5):
if i == 5:
break
else:
print(i)
else:
print("Here")
33. What will be the output of the following Python code?
for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")
for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")
34. What will be the output of the following Python code snippet?
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")
35. What will be the output of the following Python code?
x = (i for i in range(3))
for i in x:
print(i)
for i in x:
print(i)
x = (i for i in range(3))
for i in x:
print(i)
for i in x:
print(i)
36. What will be the output of the following Python code?
string = "my name is x"
for i in string:
print (i, end=", ")
string = "my name is x"
for i in string:
print (i, end=", ")
37. What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]
for a[-1] in a:
print(a[-1])
a = [0, 1, 2, 3]
for a[-1] in a:
print(a[-1])
38. What will be the output of the following Python code?
x = (i for i in range(3))
for i in x:
print(i)
x = (i for i in range(3))
for i in x:
print(i)
39. What will be the output of the following Python code?
string = "my name is x"
for i in string.split():
print (i, end=", ")
string = "my name is x"
for i in string.split():
print (i, end=", ")
40. What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]
i = -2
for i not in a:
print(i)
i += 1
a = [0, 1, 2, 3]
i = -2
for i not in a:
print(i)
i += 1