```{.python}
def count_8n(num, n):
tot_count = 0
str_n = str(n)
for i in range(0, num + 1):
temp_str = str(i)
tot_count += temp_str.count('8'str_n)
return tot_count
n = 8
tot_num = count_8n(10000, n)
print("total number of 8%d is %d" %(n, tot_num))
```
```{.python}
def count_8n(num, n):
tot_count = 0
str_n = str(n)
for i in range(0, num + 1):
temp_str = str(i)
tot_count += temp_str.count('8'str_n)
return tot_count
n = 8
tot_num = count_8n(10000, n)
print("total number of 8%d is %d" %(n, tot_num))
```