aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-08-21 15:23:40 +0100
committerGitHub <noreply@github.com>2024-08-21 15:23:40 +0100
commitedafe2d1064dabc4e7ae35b26d76061c746ef89c (patch)
treec8ae6a4a1e18852e5c9dade67180e6b80f9b8c63
parentb19a3cb73c544f862b7a454c1b8079830a8ae8e8 (diff)
parentdbcf2523a8ec2b835f88655e78a98c83b4067468 (diff)
downloadperlweeklychallenge-club-edafe2d1064dabc4e7ae35b26d76061c746ef89c.tar.gz
perlweeklychallenge-club-edafe2d1064dabc4e7ae35b26d76061c746ef89c.tar.bz2
perlweeklychallenge-club-edafe2d1064dabc4e7ae35b26d76061c746ef89c.zip
Merge pull request #10678 from pokgopun/pwc283
pwc283 - simplify ch-2.py
-rw-r--r--challenge-283/pokgopun/python/ch-2.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/challenge-283/pokgopun/python/ch-2.py b/challenge-283/pokgopun/python/ch-2.py
index a867d2d1f9..b3dc4a444c 100644
--- a/challenge-283/pokgopun/python/ch-2.py
+++ b/challenge-283/pokgopun/python/ch-2.py
@@ -41,8 +41,10 @@ SO WHAT DO YOU THINK ?
### solution by pokgopun@gmail.com
def dcv(ints):
- idx = range(len(ints))
- return set((i,ints.count(i)) for i in idx) == set((i,ints[i]) for i in idx)
+ for i in range(len(ints)):
+ if ints.count(i) != ints[i]:
+ return False
+ return True
import unittest