• Python question of the day

    What would be the output of executing the following code:
    olympic_venues = ['Beijing', 'London', 'Rio', 'Tokyo', 'Paris', 'LA']
    print(olympic_venues[1:-1:2])
     ['London', 'Rio', 'Tokyo', 'Paris']
     ['London', 'Tokyo']
     ['London', 'Rio', 'Tokyo', 'Paris', 'LA']
     ['Paris', 'LA']
    Explanation:
    The slicing, [1:-1:2], instructs to start at 1, till the last (not including the last), in steps of 2)


    Top 100 python interview questions:






datai analytics