• Python question of the day

    What would be the output of executing the following code:
    my_scores = (4, 6, 7, 9, 5, 4)
    my_scores.sort()
     (4, 5, 6, 7, 9)
     (4, 4, 5, 6, 7, 9)
     (5, 6, 7, 9)
     AttributeError
    Explanation:
    In python, 'tuple' object has only two methods - count and index. To sort a tuple you need to used sorted function. if you have a tuple named my_tup, then you can sort it by running sorted(my_tup)


    Top 100 python interview questions:






datai analytics