What will be the output of the following Python code?
i = 2 while True: if i%3 == 0: break print(i) i += 2
2 4 6 8 10 …
2 4
2 3
error
i = 1 while False: if i%2 == 0: break print(i) i += 2
1
1 3 5 7 …
1 2 3 4 …
Nothing will be printed
i = 0 while i < 3: print(i) i += 1 else: print(0)
0 1 2 3 0
0 1 2 0
0 1 2
x = "abcdef" while i in x: print(i, end=" ")
a b c d e f
abcdef
i i i i i i …
x = "abcdef" i = "i" while i in x: print(i, end=" ")
no output
x = "abcdef" i = "a" while i in x: print(i, end = " ")
a a a a a a …
x = "abcdef" i = "a" while i in x: print('i', end = " ")
i i i i i i … infinite Time
x = 'abcd' for i in range(x): print(i)
a b c d
0 1 2 3
none of the mentioned
x = 'abcd' for i in range(len(x)): print(i)
1 2 3 4
x = 'abcd' for i in range(len(x)): print(i.upper())
What will be the output of the following Python code snippet?
x = 'abcd' for i in range(len(x)): i.upper() print (x)
x = 'abcd' for i in range(len(x)): x = 'a' print(x)
a
abcd abcd abcd
a a a a
x = 'abcd' for i in range(len(x)): print(x) x = 'a'
abcd abcd abcd abcd
for i in range(0): print(i)
0
for i in range(2.0): print(i)
0.0 1.0
0 1
for i in range(int(2.0)): print(i)
x = 2 for i in range(x): x += 1 print (x)
0 1 2 3 4 …
3 4
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
What will be the output of the following Python statement?
print(chr(ord('A')+32))
A
B
Error
print(chr(ord('b')+1))
b
c