Home / CSE MCQs / Python MCQs :: Discussion

Discussion :: Python MCQs

  1. What is the output of the following?

    print('*', "abcdef".center(7), '*')
  2. A.
    * abcdef *
    B.
    * abcdef *
    C.
    *abcdef *
    D.
    * abcdef*

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    Padding is done towards the left-hand-side first when the final string is of odd length. Extra spaces are present since we haven't overridden the value of sep.


Be The First To Comment