• Python question of the day

    What would be the output of executing the following code:
    s = 'the smart owl'
    print(s[-9:-100:-2])
     aset
     set
     wo trams
     IndexError
    Explanation:
    For this slicing, the start is -9 (letter s) and is -100, so the beginning of the string (python will not throw indexerror in slicing) and step by 2 and the negative sign indicates right to left direction


    Top 100 python interview questions:


  • python bootcamp 2021
datai analytics