优化以下代码 count = 0 for i in range(1, 50): if i % 7 != 0 and i % 10 != 7: continue count += 1 print(count)
count = sum(1 for i in range(1, 50) if i % 7 == 0 or i % 10 == 7) print(count)
原文地址: https://www.cveoy.top/t/topic/hbq 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
count = sum(1 for i in range(1, 50) if i % 7 == 0 or i % 10 == 7) print(count)
原文地址: https://www.cveoy.top/t/topic/hbq 著作权归作者所有。请勿转载和采集!