题解 | #包含数字9的数#
包含数字9的数
http://www.nowcoder.com/practice/0948f4f3344c452f843afd3585dd0f8d
提供两种思路:
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)