第一次用python,成功的感觉不错。

自己的作业:

1.

count = 0
while count <= 9 :    
    count += 1
    if count == 7 :
        continue
    print (count)

2.

count = 1
sum = 0
while count <=100 :
    sum = sum + count
    count += 1
print (sum)

3.

count = 1
while count <=100 :
    print (count)
    count += 2

4.

count = 0
while count <= 100 :
    print (count)
    count += 2

5.

count1 = 1
count2 = -2
sum = 0
while count1 <=99 :
    sum = sum + count1 + count2
    count1 += 2
    count2 -= 2
print (sum)

6.

count = 1
while count <= 3:
    code = input('请输入密码:')
    if code == '123' :
        print ('输入正确!')
        break
    else :
        print ('输入错误')
        count += 1
if count > 3:
    print ('傻叉,错三次了!')

其中第六道题真的难倒我了,试了很多次才做出来,好高兴。希望自己能够喜欢上写代码的这种感觉。

posted @ 2017-12-14 19:30  裙下的小香蕉  阅读(250)  评论(0编辑  收藏  举报