The right tool for the right job ¯\(ツ)/¯
- 0 Posts
- 4 Comments
Joined 2 months ago
Cake day: June 12th, 2025
You are not logged in. If you use a Fediverse account that is able to follow users, you can follow this user.
Unittest in Python, enjoy! If you pass it with a function like the one in OPs picture, you have earned it.
import unittest import random class TestOddEven(unittest.TestCase): def test_is_odd(self): for _ in range(100): num = random.randint(-2**63, 2**63 - 1) odd_num = num | 1 even_num = num >> 1 << 1 self.assertTrue(is_odd(odd_num)) self.assertFalse(is_odd(even_num)) def test_is_even(self): for _ in range(100): num = random.randint(-2**63, 2**63 - 1) odd_num = num | 1 even_num = num >> 1 << 1 self.assertTrue(is_even(even_num)) self.assertFalse(is_even(odd_num)) if __name__ == '__main__': unittest.main()
Damn… The more I hear about stuff like this the more I like the Danish police and traffic laws… They certainly aren’t perfect, but man is most of the rest of the world a shit show when it comes to that.
In Denmark 3 km/h above the limit can get you a ticket. 30% above will get you a “point” to your drivers license and a much larger fine. 60% above and you will immediately lose your license and a large fine or potentially prison.
A “point” stays on your license for 3 years, and it you get 6 cuts, you lose your license.
I haven’t heard of anyone keeping their license “because they needed it”… You just have to bike, or take public transport.
You also get a point for many other offenses, such as using a handheld phone, crossing on red, tailgating, driving the wrong way, or many other things.
The first 3 years after getting your license, the limit is lower at 4 points, and if you lose your license and get a new license the limit is only 3 points.