Python Puzzles
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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
📑 Curly Braces inside F-strings
📑 Task 1) Will the code print out the elements of the interval? 2) What minimal changes can be made to the code to see the ...
No comments:
Post a Comment