What will be the output of the following Python code?
a) a b c d e f
b) abcdef
c) i i i i i i …
d) error
Explanation: NameError, i is not defined.
What will be the output of the following Python code?
a) no output
b) i i i i i i …
c) a b c d e f
d) abcdef
Explanation: “i” is not in “abcdef”.
What will be the output of the following Python code?
a) no output
b) i i i i i i …
c) a a a a a a …
d) a b c d e f
Explanation: As the value of i or x isn’t changing, the condition will always evaluate to True.
What will be the output of the following Python code?
a) no output
b) i i i i i i …
c) a a a a a a …
d) a b c d e f
Explanation: Here i i i i i … printed continuously because as the value of i or x isn’t changing, the condition will always evaluate to True. But also here we use a citation marks on “i”, so, here i treated as a string, not like a variable.
What will be the output of the following Python code?
a) i i i i i I
b) a a a a a a
c) a a a a a
d) none of these
Explanation: The string x is being shortened by one character in each iteration.
What will be the output of the following Python code?
a) a a a a a
b) a a a a a a
c) a a a a a a …
d) a
Explanation: String x is not being altered and i is in x[:-1].