What will be printed?
i = 0
while i < 3: i += 1 if i == 2: continue print(i, end=" ") else: print("END")
1 2 3 END
1 2 3
1 3
1 3 END
What is the output of following?
for i in range(5): if i == 3: continue print(i, end=" ")
0 1 2 3 4
0 1 2 4
1 2 3 4
0 1 2
10
Error
True
11
==
is
has
in
3.333
3
4
3.0
while
do-while
for
if
What is the output?
x = 5 y = 10 print(x > 3 or y < 5 and x == 5)
False
None
What is the output of following code?
x = 1 y = 2 z = 3 print(x < y < z == True)
1
pass
continue
break
assert
Terminates loop
Skips iteration
Prints message
Raises error if condition is False
Even numbers
Odd numbers from 1 to 9
Odd numbers from 1 to 10
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)
a b c
0 a 1 b 2 c
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)