输出100以内最大的5个能被3或5整除的数
问题描述:
怎样确定最大的五个?好像不是列表就不能采用序列的方式切片,但是又不知道怎么把他变成列表。
答
_ = []
for i in range(100, 0, -1):
if len(_) >= 5:
break
if i % 5 == 0 and i % 3 == 0:
_.append(i)
print(_)