Added HowManyNumbersWithThisDigit.py
Added README for HowManyNumbersWithThisDigit.py
This commit is contained in:
20
HowManyNumbersWithThisDigit/HowManyNumbersWithThisDigit.py
Normal file
20
HowManyNumbersWithThisDigit/HowManyNumbersWithThisDigit.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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 - typeFrom + 1):
|
||||
allNumbers.append(typeFrom + i)
|
||||
|
||||
for n in allNumbers:
|
||||
if str(whichDigit) in str(n):
|
||||
digitCount += 1
|
||||
|
||||
print()
|
||||
print("I found " + str(digitCount) + " " + str(whichDigit) + "'s")
|
||||
input()
|
||||
5
HowManyNumbersWithThisDigit/README.md
Normal file
5
HowManyNumbersWithThisDigit/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Script, that helps with founding how many numbers with this digit from X to Y
|
||||
Example: How many numbers with 0's from 1 to 10000
|
||||
|
||||
Скрипт, который помогает искать сколько числел с цифрой N от X до Y
|
||||
Например: Сколько чисел от 1 до 10000 содержат 0?
|
||||
Reference in New Issue
Block a user