Arithmetic operations on Bools?
Answer: B. False Solution: Let's go checking the if-condition, which is (3>2) > 1 Now remember that no matter what, attack the parenthesis first. So we solve (3>2), ie, True Expression simplifies to True > 1 It's a bit of a fix now. Because how to compare a bool with int? +
2
0
24
2
2K
1
0
1
0
114
Not very often, but it can be applied. For example, you have a list like so li = [5, 7, 3, 2, 9] You want to count how many items are >5. You could use sum(x>5 for x in li) This works by creating a bool (x>5). If True, adds 1. Else adds 0. Effectively counting Trues. +
1
0
1
0
24
United States Trends
- 1. Venezuela 777K posts
- 2. #SantaChat 9,207 posts
- 3. Dan Bongino 20.8K posts
- 4. Jack Smith 102K posts
- 5. Big Christmas 15.5K posts
- 6. Talavera 32.5K posts
- 7. FBI in January 7,809 posts
- 8. Endrick 16.2K posts
- 9. Coinbase 36K posts
- 10. Jared Isaacman 4,391 posts
- 11. Ewers 13.5K posts
- 12. #SystemUpdate N/A
- 13. Weaver 7,995 posts
- 14. Oscars 31.8K posts
- 15. Kawhi 5,128 posts
- 16. Cherki 34.2K posts
- 17. Old Dominion 1,029 posts
- 18. Bernie 18.4K posts
- 19. NextNRG Inc 1,530 posts
- 20. Fani 37.1K posts
Loading...
Something went wrong.
Something went wrong.