Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Python code?
x = “abcdef”
i = “a”
while i in x[:-1]:
print(i, end = ” “)

What will be the output of the following Python code?
x = “abcdef”
i = “a”
while i in x[:-1]:
print(i, end = ” “)
a) a a a a a
b) a a a a a a
c) a a a a a a …
d) a

Answer: c
Explanation: String x is not being altered and i is in x[:-1].

Join The Discussion