diff options
| author | Lubos Kolouch <lubos@kolouch.net> | 2023-12-09 13:28:55 +0100 |
|---|---|---|
| committer | Lubos Kolouch <lubos@kolouch.net> | 2023-12-09 13:28:55 +0100 |
| commit | f799336296db128ce6e2c8f7d7d35437c6d4f83f (patch) | |
| tree | afedeb380accb816e0196ff36cfeab37f9a97e89 /challenge-246/lubos-kolouch/python/ch-1.py | |
| parent | 3c1ecc6b938552014db14317e655085ab507ae90 (diff) | |
| download | perlweeklychallenge-club-f799336296db128ce6e2c8f7d7d35437c6d4f83f.tar.gz perlweeklychallenge-club-f799336296db128ce6e2c8f7d7d35437c6d4f83f.tar.bz2 perlweeklychallenge-club-f799336296db128ce6e2c8f7d7d35437c6d4f83f.zip | |
Challenge 246 LK Perl Python Raku blog
Diffstat (limited to 'challenge-246/lubos-kolouch/python/ch-1.py')
| -rw-r--r-- | challenge-246/lubos-kolouch/python/ch-1.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/challenge-246/lubos-kolouch/python/ch-1.py b/challenge-246/lubos-kolouch/python/ch-1.py new file mode 100644 index 0000000000..7428e5f573 --- /dev/null +++ b/challenge-246/lubos-kolouch/python/ch-1.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import random +from typing import List + + +def pick_lotto_numbers() -> list[int]: + return random.sample(range(1, 50), 6) + + +# Test +import unittest + + +class TestLottoNumbers(unittest.TestCase): + def test_lotto_numbers(self): + result = pick_lotto_numbers() + self.assertEqual(len(result), 6) + self.assertEqual(len(set(result)), 6) + for num in result: + self.assertTrue(1 <= num <= 49) + + +if __name__ == "__main__": + unittest.main() + +# Main +for num in sorted(pick_lotto_numbers()): + print(num) |
