• Python question of the day

    What would be the output of executing the following code:
    s = list(range(10,20)[:4])
    s[:]= 11
    print(s)
     [11]
     [10, 11, 12, 13, 11]
     [10, 11, 12, 13, 14, 11]
     TypeError
    Explanation:
    In python, you can only assign an iterable to a slice; something with 0 or more values, not one specific value.


    Top 100 python interview questions:






datai analytics