• Python question of the day

    What would be the output of executing the following code:
    t = 'Hello Python'
    for i in range(5): t = tuple(t)
    print(len(t))
     1
     11
     12
     60
    Explanation:
    The tuple constructor uses the characters of the string to create the tuple. The same tuple will be created in the loop for each iteration. So the tuple in each iteration would be ('H', 'e', 'l', 'l', 'o', ' ', 'P', 'y', 't', 'h', 'o', 'n')


    Top 100 python interview questions:






datai analytics