diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-12-13 20:52:20 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-12-13 20:52:20 +0000 |
| commit | 03afabe9463c8aa4b186f922d5d008503e5e4db8 (patch) | |
| tree | b3edad8d2d38e0e8add70ca19a49e8b31a912fcf /challenge-195/robert-dicicco/python | |
| parent | be12e28b732e44cbbc1de235c5e4df09aa12b9df (diff) | |
| download | perlweeklychallenge-club-03afabe9463c8aa4b186f922d5d008503e5e4db8.tar.gz perlweeklychallenge-club-03afabe9463c8aa4b186f922d5d008503e5e4db8.tar.bz2 perlweeklychallenge-club-03afabe9463c8aa4b186f922d5d008503e5e4db8.zip | |
- Added guest contributions by Robert DiCicco.
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") |
