diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-06-17 09:08:23 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-06-17 09:08:23 +0100 |
| commit | feb941721732ebbad6afeddc133b25ea762d9854 (patch) | |
| tree | d7b76fd4b4ccf6756f453df8e3b05eb9e683b8cc /challenge-221/robert-dicicco/python | |
| parent | a4958e946480959cf52f795bda20da4ff60b9fbc (diff) | |
| download | perlweeklychallenge-club-feb941721732ebbad6afeddc133b25ea762d9854.tar.gz perlweeklychallenge-club-feb941721732ebbad6afeddc133b25ea762d9854.tar.bz2 perlweeklychallenge-club-feb941721732ebbad6afeddc133b25ea762d9854.zip | |
- Added solutions by Matthias Muth.
- Added solutions by Simon Proctor.
- Added solutions by Laurent Rosenfeld.
- Added solutions by Robert DiCicco.
- Added solutions by Ulrich Rieke.
- Added solutions by Thomas Kohler.
- Added solutions by Mark Anderson.
- Added solutions by E. Choroba.
- Added solutions by David Ferrone.
- Added solutions by W. Luis Mochan.
- Added solutions by Bob Lied.
- Added solutions by Peter Campbell Smith.
- Added solutions by Ali Muradi.
- Added solutions by Robbie Hatley.
- Added solutions by Jorg Sommrey.
- Added solutions by Lubos Kolouch.
- Added solutions by Niels van Dijke.
- Added solutions by Roger Bell_West.
- Added solutions by Arne Sommer.
- Added solutions by Robert Ransbottom.
- Added solutions by Andreas Vogele.
Diffstat (limited to 'challenge-221/robert-dicicco/python')
| -rw-r--r-- | challenge-221/robert-dicicco/python/ch-1.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/challenge-221/robert-dicicco/python/ch-1.py b/challenge-221/robert-dicicco/python/ch-1.py new file mode 100644 index 0000000000..5433676bd3 --- /dev/null +++ b/challenge-221/robert-dicicco/python/ch-1.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# ------------------------------------- +# AUTHOR: Robert DiCicco +# DATE : 2023-06-13 +# Challenge 221 Task 1 Good Strings ( Python ) +# ------------------------------------- + +total_score = 0 + +words = [["cat", "bt", "hat", "tree"], ["hello", "world", "challenge"]] +chlist = ["atach","welldonehopper"] +cnt = 0 +listcnt = 0 + +for wds in words: + print("Input: @words = ",wds) + chars = chlist[cnt] + total_score = 0 + score = 0 + for w in wds: + ln = len(w) + for mycnt in range(0,ln): + tst = w[mycnt] + if tst in chlist[listcnt]: + score += 1 + else: + break + if score == ln: + print(w) + total_score += score + score = 0 + print("\tTotal: ",total_score) + print("") + listcnt += 1 + +# ------------------------------------- +# SAMPLE OUTPUT +# python .\GoodStrings.py + +# Input: @words = ['cat', 'bt', 'hat', 'tree'] +# cat +# hat + # Total: 6 + +# Input: @words = ['hello', 'world', 'challenge'] +# hello +# world + # Total: 10 +# ------------------------------------- + + |
