• Python question of the day

    What would be the output of executing the following code:
    x,y = (False, False)
    if (y,) and [y,]: x+=1
    print(x)
     0
     1
     False
     SyntaxError
    Explanation:
    All non-empty iterables (tuple and list in this example) will evaluate to True and True and True is True and hence x will become 1 and it will be printed


    Top 100 python interview questions:


  • python bootcamp 2021
datai analytics