dic = {'0':0} for i in range(1000): if i % 3 == 0 and i %5 == 0 and i % 10 != 0: dic['0'] += 1 print("1000以内能被3或5整除但不能被10整除的数的个数为:",dic['0'])
使用字典的键 作为变量进行相加
2020-06-07