编写程序输出元组内7的倍数及个位是7的数: b=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
时间: 2023-10-08 22:11:28 浏览: 112
爆款少儿青少年scratch编程第18课:7的倍数(下)
b=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
result = []
for num in b:
if num % 7 == 0 or num % 10 == 7:
result.append(num)
print(result) # 输出[7, 14]
阅读全文