Home / CSE MCQs / Python MCQs :: Discussion

Discussion :: Python MCQs

  1. What is the output of the following?

    x = "abcdef"
    i = "a"
    while i in x:
        x = x[:-1]
        print(i, end = " ")
  2. A.
    i i i i i i
    B.
    a a a a a a
    C.
    a a a a a
    D.
    none of the mentioned

    View Answer

    Workspace

    Answer : Option B

    Explanation :

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


Be The First To Comment