diff options
| author | James Smith <js5@sanger.ac.uk> | 2022-12-15 01:57:55 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-15 01:57:55 +0000 |
| commit | e2b33f546bda365fe677e14e725bb53a5f23798c (patch) | |
| tree | a99ca3ed8e82e367b0aba5acd5cec50e5b48757f /challenge-195/robert-dicicco/python | |
| parent | 2b99b6e28c2a3b672e50d7b22cd3e1c6998670c7 (diff) | |
| parent | c1d3932971f399789d4ee01cb886bb1e984f2563 (diff) | |
| download | perlweeklychallenge-club-e2b33f546bda365fe677e14e725bb53a5f23798c.tar.gz perlweeklychallenge-club-e2b33f546bda365fe677e14e725bb53a5f23798c.tar.bz2 perlweeklychallenge-club-e2b33f546bda365fe677e14e725bb53a5f23798c.zip | |
Merge branch 'manwar:master' into master
Diffstat (limited to 'challenge-195/robert-dicicco/python')
| -rw-r--r-- | challenge-195/robert-dicicco/python/ch-1.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/challenge-195/robert-dicicco/python/ch-1.py b/challenge-195/robert-dicicco/python/ch-1.py new file mode 100644 index 0000000000..1a1678775e --- /dev/null +++ b/challenge-195/robert-dicicco/python/ch-1.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +''' + +AUTHOR: Robert DiCicco + +DATE : 2022-12-13 + +Challenge 195 Special Integers ( Python ) + + + +SAMPLE OUTPUT + +python .\SpecialIntegers.py + +Input: $n = 15 + +Output: 14 + + + +Input: $n = 35 + +Output: 32 + +------------------------------------------------- + +''' + + + +def CheckUniqueDigits(n) : + + seen = {} + + my_list = [int(x) for x in str(n)] + + for onedig in my_list: + + if onedig in seen: + + return 0 + + else : + + seen[onedig] = 1 + + return 1 + + + +for n in [15, 35] : + + output = 0 + + print("Input: $n = ", n) + + for x in range(0,n): + + output += CheckUniqueDigits(x) + + print(f"Output: {output}\n") |
