From 9525237d2c768048e582e24a3417b49e81add65c Mon Sep 17 00:00:00 2001 From: BarsTiger Date: Thu, 8 Jul 2021 18:09:46 +0300 Subject: [PATCH] Added HowManyThatDigit --- .../HowManyThatDigitFromXtoY.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 HowManyThatDigitFromXtoY/HowManyThatDigitFromXtoY.py diff --git a/HowManyThatDigitFromXtoY/HowManyThatDigitFromXtoY.py b/HowManyThatDigitFromXtoY/HowManyThatDigitFromXtoY.py new file mode 100644 index 0000000..4c6c743 --- /dev/null +++ b/HowManyThatDigitFromXtoY/HowManyThatDigitFromXtoY.py @@ -0,0 +1,24 @@ +print("©KOTIKOT, script by BarsTiger") +print() + +typeFrom = int(input("All numbers from: ")) +typeTo = int(input("All numbers to: ")) +whichDigit = int(input("What should I find: ")) + +allNumbers = "" +digitCount = 0 + +for i in range(typeTo): + allNumbers = allNumbers + str(typeFrom + i) + +allNumbersList = [] + +for i in range(len(allNumbers)): + allNumbersList.append(int(allNumbers[i])) + +for n in range(len(allNumbersList)): + if allNumbersList[n] == whichDigit: + digitCount += 1 + +print() +print("I found " + str(digitCount) + " " + str(whichDigit) + "'s")