打印从1到n的数字,如果其中有数字K,请跳过,我的代码有什么问题?

时间:2018-10-09 13:46:50

标签: python python-3.x

x = int(input())
d = int(input())
def isDigitPresent(x, d): 
    while (x > 0):   
        if (x % 10 == d or x / 10 == d): 
            break
        x = x / 10
    return (x > 0) 

for i in range(1,x+1):
    if(i == d or isDigitPresent(i,d)):
        continue
    else:
        print(i)

0 个答案:

没有答案