pythonc成长之旅3

python作业

1.使用while循环输出:1 2 3 4  5 6 8 9 10

2.求1——100的所有数的和

3.输出1——100内的所有奇数

4.输出1——100内的所有偶数

5.求1-2+3-4+5........99的所有数的和

6.用户登录(三次机会)

 用户登录,代码pycharm如下:

用户登录(三次机会)
count = 0
while count < 3:
    user = input('')
    pwd  = input('')
    if user == 'alex' and pwd == '1234':
        print('hello my gods')
        print('..............')
        break
else:
    print('yours count or code is error!')
    count = count + 1

我在pycharm中写出这个代码的适合,首先遇到缩进错误,然后遇到if语句循环错误。

主要  注意python中严格的缩进问题。

然后  多练习各个数据结构的使用。

猜你喜欢

转载自www.cnblogs.com/lhai000/p/9350778.html