发布于2020-02-10 16:58 阅读(1142) 评论(0) 点赞(14) 收藏(1)
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 | #登录,账户密码储存在文件中,限制登录 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")
*************************************************************************************************************
作者:我下面给你吃
链接:https://www.pythonheidong.com/blog/article/230999/bcfcbcb46c0b2974b3bc/
来源:python黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 python黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-1
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!