summaryrefslogtreecommitdiffstats
path: root/solutions/py/04-2.py
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2019-12-08 11:06:56 +0100
committerGustav Sörnäs <gusso230@student.liu.se>2019-12-08 11:06:56 +0100
commit29e33f8f6a31565f5a2671b1c459ff1b829630f7 (patch)
treec051274a9e9a895049a077a6bdce9056dfb9afb1 /solutions/py/04-2.py
parentd16fc72a33fced8c8623bea6cf9cdd9cf8999024 (diff)
downloadaoc-29e33f8f6a31565f5a2671b1c459ff1b829630f7.tar.gz
Refactor and create main.py
Diffstat (limited to 'solutions/py/04-2.py')
-rw-r--r--solutions/py/04-2.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/solutions/py/04-2.py b/solutions/py/04-2.py
deleted file mode 100644
index 582df1a..0000000
--- a/solutions/py/04-2.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from collections import Counter
-
-def containsDouble(num):
- s = str(num)
- amounts = []
- for n in (0,1,2,3,4,5,6,7,8,9):
- amounts.append(s.count(str(n)))
- c = Counter(amounts)
- if c[0] + c[1] < 10:
- return c[2] >= 1
-
-def isIncreasing(num):
- s = str(num)
- n = int(s[0])
- for sp in s[1:]:
- if int(sp) < n:
- return False
- n = int(sp)
- return True
-
-if __name__ == "__main__":
- amount = 0
- for n in range(357253, 892942 + 1):
- if containsDouble(n):
- if isIncreasing(n):
- print(n)
- amount += 1
- if n % 10000 == 0:
- pass
- # print(n)
- print(amount)