Week 13: Sum of basics

Post date: Jan 27, 2017 3:58:49 PM

y = 0

z = 0

digit = input("Give me a digit:")

digits = int(input("How many digits:"))

for x in range(10**(digits-1), 10**(digits)):

if str(x).count(digit) > 0:

y = y + 1

z = z + str(x).count(digit)

print("Number of found:", y)

print("Total", digit, "s:", z)