提供两种思路:
for循环
b=0
for x in range(1,2020):
if "9" in str(x):
b+=1
print(b)
while循环
a=1
b=0
while a<2020:
if "9" in str(a):
b+=1
a=a+1
print(b)
b=0
for x in range(1,2020):
if "9" in str(x):
b+=1
print(b)
a=1
b=0
while a<2020:
if "9" in str(a):
b+=1
a=a+1
print(b)