• Python question of the day

    In python 3.8 or later, what would be the output of executing the following code:
    run = 20/2
    [run := run + x for x in range(10)]
    print(run)
     45
     55
     55.0
     45.0
    Explanation:
    In python 3.8 or later versions, in most contexts where arbitrary Python expressions can be used, a named expression can be used. This is of the form NAME := expr where expr is any valid Python expression other than an unparenthesized tuple, and NAME is an identifier.


    Top 100 python interview questions:






datai analytics