Python分别输出0-100内的奇数和偶数
a=[]b=[]for i in range (1,101):if i%2==0:a.append(i)print(“0-100内的偶数有”)print(a)else:b.append(i)print(“0—100内的奇数有”)print(b)
·
a=[]
b=[]
for i in range (1,101):
if i%2==0:
a.append(i)
print(“0-100内的偶数有”)
print(a)
else:
b.append(i)
print(“0—100内的奇数有”)
print(b)
更多推荐
已为社区贡献1条内容
所有评论(0)