• Python question of the day

    Which of the following python statements, when executed, will NOT give the output 0.3
     print(round(0.33,1))
     print(round(1/3,1))
     print(round(0.55,1) - round(0.35,1))
     print(0.1 + 0.1 + 0.1)
    Explanation:
    print(0.1 + 0.1 + 0.1) gives 0.30000000000000004 due to the rounding inherent to the Cpython implementation


    Top 100 python interview questions:






datai analytics