#登录,账户密码储存在文件中,限制登录

count = 0

for i in range(3):
b = input("账号:")
c = b + "," + input("密码:")+"\n" passwd_f = open('D:\python\password_f.txt', 'r')
text = passwd_f.readlines()
for j in range(len(text)):
if text[j] == b + "\n":
print("----账号已经被锁定----")
exit() passwd = open('D:\python\password.txt', 'r')
text = passwd.readlines()
for h in range(len(text)):
if text[h] == c:
print("------欢迎你------")
exit() print("--密码或账户错误--")
passwd.close()
else:
print("--账户已经被锁定--")
passwd_f = open('D:\python\password_f.txt', 'a')
passwd_f.write(b + "\n")
passwd_f.close()
#username = input("账号:")
#password = input("密码:")

打印九九乘法表

1*1=1
2*1=2 2*2=4
3*1=3 3*2=6 3*3=9
4*1=4 4*2=8 4*3=12 4*4=16
5*1=5 5*2=10 5*3=15 5*4=20 5*5=25
6*1=6 6*2=12 6*3=18 6*4=24 6*5=30 6*6=36
7*1=7 7*2=14 7*3=21 7*4=28 7*5=35 7*6=42 7*7=49
8*1=8 8*2=16 8*3=24 8*4=32 8*5=40 8*6=48 8*7=56 8*8=64
9*1=9 9*2=18 9*3=27 9*4=36 9*5=45 9*6=54 9*7=63 9*8=72 9*9=81

num_h=1
while num_h<=9:#循環h行  
    temp=1
    while temp<=num_h:   #循環l列
        print(str(num_h) + "*" + str(temp)+"="+ str(num_h*temp),end=" ")#打印不換行
        temp =temp+1
        
    print()  #換行
    num_h+=1

***************************************************************************************************

隨機輸入成績判斷等級

score =int(input("score:"))

if score>90:
    print("A")
elif score>80:
    print("B")
elif score>70:
    print("c")
else:
    print("D")

*************************************************************************************************

打印星星
****
****
****
****
h=int(input("chang:"))#輸入高度

l=int(input("kuan:"))#輸入寬度

num_h=1

while num_h<=l:#循環h行
    num_l=1
    while num_l<=h:   #循環l列
        print("*",end="")#打印不換行
        num_l+=1
    print()  #換行
    num_h+=1

************************************************************************************

打印星星
*
**
***
****

h=int(input("chang:"))#輸入高度
num_h=1
while num_h<=h:#循環h行  
    temp=num_h
    while temp>0:   #循環l列
        print("*",end="")#打印不換行
        temp =temp-1
    print()  #換行
    num_h+=1

**********************************************************************************************

比大小

a=input("a:")
b=input("b:")
c=input("c:")
sum=""

if a>b:
    sum=a
    if sum>c:
        print("max is",a)
    else:
        print("max is ",c)
else:
    sum=b
    if sum>c:
        print("max is",b)
    else:
        print("max is ",c)

**************************************************************************************

猜年龄

age_of_princal=56

while True:
    guess_age=int(input(">>:"))
    if guess_age==age_of_princal:
        print("yes,you got it")
        break      #跳出程序
    elif guess_age>age_of_princal:
        print("should try smaller....")
    else:
        print("try bigger....")
print("end")

*************************************************************************************************************

最新文章

  1. Eclipse: 提示 Toolchain &quot;MinGW GCC&quot; is not detected
  2. IOS中的多线程之GCD
  3. session,cookie
  4. [Hibernate] - Annotations - One To One
  5. (二) win8+XAML Binding(数据绑定)
  6. OpenJudge/Poj 2013 Symmetric Order
  7. java_method_MD5加密
  8. 【C#基础】json数据解析
  9. [AngularJS + RxJS] Search with RxJS
  10. MySQL远程登陆错误
  11. 在Spring Boot框架下使用WebSocket实现聊天功能
  12. Python内置函数(56)——set
  13. 第十三节,卷积神经网络之经典网络LeNet-5、AlexNet、VGG-16、ResNet(三)(后面附有一些网络英文翻译文章链接)
  14. stark组件开发之列表页面应用示例
  15. 用DotNetOpenAuth实现基于OAuth 2.0的web api授权 (一)Getting Start
  16. AOJ 0005 GCD and LCM
  17. openstack--7--创建一台虚拟机
  18. 学习笔记: js插件 —— SuperSlide 2 (轮播图插件,PC用)
  19. 20145303刘俊谦 Exp7 网络欺诈技术防范
  20. Ext BoxComponent

热门文章

  1. 每日一技|巧用 Telnet 调试 Dubbo 服务
  2. 毕业论文系列之基于WiFi的智能农业大棚管控系统设计代码
  3. copy constructor和copy assignment operator的区别
  4. Codeforces_338_D
  5. 《Python学习手册 第五版》 -第13章 while循环和for循环
  6. Virus:病毒查杀
  7. 题解 USACO12DEC【逃跑的BarnRunning Away From…】
  8. 全网一定不是最好懂的C++线性筛素数
  9. Spark API 之 map、mapPartitions、mapValues、flatMap、flatMapValues详解
  10. 手把手带你阅读Mybatis源码(二)执行篇