diff options
| author | Conor Hoekstra <codereport@outlook.com> | 2021-12-24 22:16:15 -0500 |
|---|---|---|
| committer | Conor Hoekstra <codereport@outlook.com> | 2021-12-24 22:16:15 -0500 |
| commit | c804b128cf740d95b244cd3fe15e86d0820ab51e (patch) | |
| tree | b9db7c3a5f93e6a83640f56bfd5decb9bbe8dbfe /challenge-030/paulo-custodio/python/ch-2.py | |
| parent | 116add27d0d74360c7d4ad26b12d972657e51afa (diff) | |
| parent | 6f518c687f743b68d3eeddedcf3d831aca20d4ec (diff) | |
| download | perlweeklychallenge-club-c804b128cf740d95b244cd3fe15e86d0820ab51e.tar.gz perlweeklychallenge-club-c804b128cf740d95b244cd3fe15e86d0820ab51e.tar.bz2 perlweeklychallenge-club-c804b128cf740d95b244cd3fe15e86d0820ab51e.zip | |
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
Diffstat (limited to 'challenge-030/paulo-custodio/python/ch-2.py')
| -rw-r--r-- | challenge-030/paulo-custodio/python/ch-2.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-030/paulo-custodio/python/ch-2.py b/challenge-030/paulo-custodio/python/ch-2.py new file mode 100644 index 0000000000..29da0ffd41 --- /dev/null +++ b/challenge-030/paulo-custodio/python/ch-2.py @@ -0,0 +1,19 @@ +#!/usr/bin/python3 + +# Challenge 030 +# +# Task #2 +# Write a script to print all possible series of 3 positive numbers, where in +# each series at least one of the number is even and sum of the three numbers +# is always 12. For example, 3,4,5. + +import sys + +S = int(sys.argv[1]) + +for i in range(1, S+1): + for j in range(i+1, S+1): + for k in range(j+1, S+1): + if sum([i, j, k]) == S: + if any([x%2==0 for x in [i, j, k]]): + print(f"{i},{j},{k}") |
