1.
#!/usr/bin/env Python
# coding:utf-8
_author_ = "tom"
'''
@author:houruiyun
@file:2.py
@contact:674211605.qq.com
@time:6/25/172:45 AM
@desc:
'''
for i in range(1,4):
name = raw_input('please input your name:')
password = raw_input('your password:')
if (name == 'root' and password == 'westos'):
print 'welcome to user manager system'
exit (0)
else:
print 'the user and password is not matching'
print ('你已经登陆过三次,请十分钟后登陆')
2.打印所有小于10并且大于或等于0的所有偶数;
打印所有小于10并且大于或等于0的最大偶数
源代码:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
3.判断一个数是否为质数
源代码:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
测试:
8.创建一用户登陆程序:保存用户的用户名与密码
新建用户时,判断用户名是否已经存在,若已经存在则报错;
登陆系统时,确保用户名存在于系统中,密码正确,有三次机会,超过三次则报错
源代码:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
测试: