• Python question of the day

    What would be the output of executing the following code:
     5 4 3 2 1 End
     5 4 3 2 1
     5
     TypeError
    Explanation:
    sum (range (2, 4)) gives sum(2, 3) which is 5. While n becomes True as n = 5 now. In the loop, 5 will be printed, 1 will be subtracted from 5 to make it 4 and loop breaks.


    Top 100 python interview questions:






datai analytics