Report Bug
Qus :

What will be the output of the following Python code?

x = "abcdef"
i = "a"
while i in x:
    x = x[1:]
    print(i, end = " ")

Qus

निम्नलिखित Python कोड का आउटपुट क्या होगा?

x = "abcdef"
i = "a"
while i in x:
    x = x[1:]
    print(i, end = " ")


A. a a a a a a
B. a
C. no output
D. error


Solution
B. a



Explanation
The string x is being shortened by one character in each iteration.



Report Bug