- 0 Posts
- 4 Comments
Joined 1 month 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()
FrederikNJS@lemmy.zipto Technology@lemmy.world•Trump social media site brought down by Iran hackersEnglish5·1 month agoThese DDOS for hire services make use of hacked machines as botnets to perform the DDOS attacks.
So while the people paying for the service didn’t hack anything, the people performing the DDOS certainly did.
The right tool for the right job ¯\(ツ)/¯