Wednesday, May 1, 2024

📑 Boolean Functions for Non-Boolean Objects

📑 Task

1) What will the program print?
2) Explain the result of summation using a code snippet

📑 Answer

1) [] (Ellipsis,) {} {None}, 2, 3, 1
2) sum() calculates the sum of the boolean values (True = 1, False = 0)

No comments:

Post a Comment