count = 99 for n in range(1, 100): if n % 7 == 0 or str(n).endswith("7"): continue count = count - 1 print("计算员工一共拍腿{}次".format(count)) #第二种方法 count = 0 for n in range(1, 100): if n % 7 == 0 or str(n).endswith("7"): count = count + 1 print("计算员工一共拍腿{}次".format(count))