python-005(1-100奇数和偶数)

时间:2020-05-10 10:43:47   收藏:0   阅读:52
# 输出 1-100 的奇数
start = 1
while start <= 100:
    temp = start % 2
    if temp == 1:
        print(start)
    else:
        pass
    start += 1

# 输出1-100 偶数
start = 1
while start <= 100:
    temp = start % 2
    if temp == 1:
        # print(start)
        pass
    else:
        # pass
        print(start)
    start += 1

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!