简易版: #!/usr/bin/env python # _*_ coding:UTF-8 _*_ # __auth__:Dahlhin import sys userinfo = r'userinfo.txt' userlock = r'userlock.txt' def user_exist_check(user): '''检查用户是否存在''' with open(userinfo) as fd: for info in fd: if user == info.strip().split(…
利用函数打印9*9乘法表 def cheng(num): for i in range(1,num+1): for j in range(1,i+1): print('{0} * {1} = {2}'.format(i,j,i*j),end=' ') print('\n',end='') cheng(9)…
1.实现1-100的所有的和 # 方法1: sum = 0 for i in range(1,101): sum += i print(sum) # 方法2: num1 = int(input('请输入起始数字')) num2 = int(input('请输入末尾数字')) sum = (num1 + num2) * num2 / 2 print(int(sum)) 2.实现1-500所有奇数的和 sum = 0 for i in range(1,501): _,result = divmod(…