diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-09-04 19:20:13 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-09-04 19:20:13 +0100 |
| commit | 63fb232da613d50a6b28166cec620d3738f24e20 (patch) | |
| tree | 3892d402274c10ba5580656e4c89cfe884462b8e /challenge-180/laurent-rosenfeld/python/ch-1.py | |
| parent | d4fb734fa6a97b50c3cf0655475fe3c34801ce55 (diff) | |
| download | perlweeklychallenge-club-63fb232da613d50a6b28166cec620d3738f24e20.tar.gz perlweeklychallenge-club-63fb232da613d50a6b28166cec620d3738f24e20.tar.bz2 perlweeklychallenge-club-63fb232da613d50a6b28166cec620d3738f24e20.zip | |
- Added more guest contributions by Laurent Rosenfeld.
Diffstat (limited to 'challenge-180/laurent-rosenfeld/python/ch-1.py')
| -rw-r--r-- | challenge-180/laurent-rosenfeld/python/ch-1.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/challenge-180/laurent-rosenfeld/python/ch-1.py b/challenge-180/laurent-rosenfeld/python/ch-1.py new file mode 100644 index 0000000000..254e6a04e5 --- /dev/null +++ b/challenge-180/laurent-rosenfeld/python/ch-1.py @@ -0,0 +1,9 @@ +"""Find the first unique character in the given string""" +for test in ["Perl Weekly Challenge", "Long Live Perl"]: + histo = dict() + for char in test: + histo[char] = histo.get(char, 0) + 1 + for i in range(0, len(test)): + if histo[test[i]] == 1: + print(test, ": ", i) + break |
