猫史档案馆


看看我滴向日葵银行,整个作品还是很细致的,代码很简单,是我初学3个月的代码,新手小白可以看一下,

用户:热爱学习的小兔纸SUSAN热爱学习的小兔纸SUSAN查看:0 回复:1 评论:0 创建时间:2021-01-28T21:05:31


center_imageemotion_编程猫_点赞emotion_编程猫_加油emotion_编程猫_紧张emotion_编程猫_嗨起来emotion_编程猫_谢谢老板emotion_编程猫_点赞emotion_编程猫_厉害了                 大家可以看一下,也有部分注释,希望提出可以优化的地方哦

 

import turtle
import time
import random
#画画笔🖊
pen = turtle.Pen() 
pen.speed(0)
pen.hideturtle()

#闪烁笔🖊
pen_1 = turtle.Pen()
pen_1.speed(0)
pen_1.hideturtle()

#写字笔🖊
pen_2 = turtle.Pen()
pen_2.speed(0)
pen_2.hideturtle()
turtle.screensize(600, 450)


def flowers():
    #绘制“钻石花"
    pen.fillcolor("gold")
    pen.begin_fill()
    for i in range(26):
        for i in range(5):
            for i in range(10):
                pen.pencolor("black")
                pen.forward(10)
                pen.left(10)
            pen.left(120)
        pen.left(90)
        pen.pendown()
    pen.end_fill()
LIST = ["orange", "gold", "yellow", "sandybrown", "tomato"]

def money(n):
    pen.up()
    for c in range(5):
        pen.color(LIST[c])
        pen.goto(-255+c+1, 200-c-1)
        pen.write("天才刘小媛银行欢迎使用", font=("宋体", 35))
    
    pen.up()
    pen.goto(170,100)
    flowers()
    pen.up()
    pen.goto(-200, 100)
    pen.color("yellow")
    for i in range(n//100):
        pen.setheading(90)
        pen.begin_fill()
        for j in range(2):
            pen.down()
            pen.fillcolor("hotpink")
            pen.fd(30)
            pen.right(90)
            pen.fd(70)
            pen.right(90)
        pen.end_fill()
        pen.up()
        pen.setheading(270)
        pen.fd(10)
        pen.setheading(0)
        pen.fd(10)
    pen_1.up()
    pen_1.goto(-250, -190)
    while True:
        pen_1.color(random.random(), random.random(), random.random())
        pen_1.write("恭喜您ヾ(≧ ▽ ≦)ゝ存款成功", font=("宋体", random.randint(20, 30)))
        time.sleep(0.05)
        pen_1.clear()

姓名 = input("请输入您的姓名?")
密码 = input("请输入您的密码?")
#密码 = "lzh12"
pen.speed(0)
pen.color("purple")
有大写 = False
有小写 = False
有数字 = True
for i in 密码:
    if "A" <= i <= "Z":
        有大写 = True
    if "a" <= i <= "z":
        有小写 = True


#请添加判断数字的语句






pen.up()
pen.goto(-200,0)
keep_going = True
while keep_going == True:
    if len( 密码 ) >= 15 and 有大写 and 有小写 and 有数字:
        pen.up()
        pen.goto(-200,0)
        pen_2.write("{}您的密码足够安全,您可以放心了".format(姓名), font = ("宋体", 25))
        pen_2.clear()
        time.sleep(2)
        M = random.randint(500, 2800)
        print("运行结束,本次存储金额共{}元".format(M))
        print("谢谢使用welcome to you next time!")
        money(M)
        keep_going = False
    else:
        pen.up()
        pen.goto(-200, 0)
        pen_2.write("{}您的密码太弱了,请更换密码".format(姓名), font=("宋体", 25))
        a = input("您要更新密码吗?(y/n)")
        if a == "y":
            密码_2 = input("请输入新密码?")
            if len(密码_2) >= 15 and 有大写 and 有小写 and 有数字:
                pen_2.clear()
                pen_2.write("{}您的密码足够安全,您可以放心了".format(姓名), font=("宋体", 25))
                pen_2.clear()
                time.sleep(2)
                M = random.randint(500, 2800)
                print("运行结束,本次存储金额共{}元".format(M))
                money(M)
                keep_going = False
            else:
                pen_2.clear()
                pen_2.write("{}您的密码太弱了,本次操作失败".format(姓名), font=("宋体", 25))
                print("谢谢使用welcome to you next time!")
                keep_going = False

        elif a == "n":
            print("谢谢使用welcome to you next time!")
            keep_going = False
time.sleep(2)
print("运行结束,本次存储金额失败")
turtle.done()


回复

上一页1 页 / 共 1下一页
热爱学习的小兔纸SUSAN热爱学习的小兔纸SUSAN

中间有设置了判断密码中是否有数字的内容,后续会发给大家,猜猜看,也不知道你们和我想到的是不是一样呢?emotion_编程猫_加油

点赞0


评论