diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-05-02 17:08:02 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-05-02 17:08:02 +0100 |
| commit | fc8013d400fee6ab06de6dc4da285d877b3eb555 (patch) | |
| tree | b396e4a4c039a88053b43b9994b7b0b6f5ad746b /challenge-215/robert-dicicco/python | |
| parent | 30c20702df85ea5c5c9470634fedbeb954360884 (diff) | |
| download | perlweeklychallenge-club-fc8013d400fee6ab06de6dc4da285d877b3eb555.tar.gz perlweeklychallenge-club-fc8013d400fee6ab06de6dc4da285d877b3eb555.tar.bz2 perlweeklychallenge-club-fc8013d400fee6ab06de6dc4da285d877b3eb555.zip | |
- Added solutions by Robert DiCicco.
Diffstat (limited to 'challenge-215/robert-dicicco/python')
| -rw-r--r-- | challenge-215/robert-dicicco/python/ch-1.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/challenge-215/robert-dicicco/python/ch-1.py b/challenge-215/robert-dicicco/python/ch-1.py new file mode 100644 index 0000000000..158c58097c --- /dev/null +++ b/challenge-215/robert-dicicco/python/ch-1.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +''' +---------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-01 +Challenge 215 Odd One Out ( Python ) +---------------------------------------- +''' + +words = [["abc","xyz","tsu"],["rat", "cab", "dad"],["x", "y", "z"]] + +for wds in words: + cnt = 0 + print("Input: @words = ",wds) + for w in wds: + w_sorted = ''.join(sorted(w, key=str.lower)) + if w != w_sorted: + cnt += 1 + print("Output: ",cnt,"\n") + +''' + ---------------------------------------- +SAMPLE OUTPUT +python .\OddOneOut.py +Input: @words = ['abc', 'xyz', 'tsu'] +Output: 1 +Input: @words = ['rat', 'cab', 'dad'] +Output: 3 +Input: @words = ['x', 'y', 'z'] +Output: 0 + ---------------------------------------- +''' + + |
