Commit 7e785a7d by BellCodeEditor

auto save

parent 5b9a8767
i = 3
username = "python"
userpassword= "123456"
while True:
if i>0:
name= input("请输入你的用户名:")
password=input("请输入你的密码:")
i-=1
if name==username and password==userpassword:
print("登录成功")
break
if name != username:
print("用户名错误,请重新输入!")
print("温馨提示:你还有"+str(i)+"次登录机会")
continue
if password != userpassword:
print("密码错误,请重新输入!")
print("温馨提示:你还有"+str(i)+"次登录机会")
else:
print("你的账户已被锁住,请一个小时候再试!")
exit()
print("欢迎来到贝尔世界!")
import turtle
pen= turtle.Pen()
color=input("你想要的颜色是?")
pen.fillcolor(color)
pen.begin_fill()
for i in range(5):
pen.forward(200)
pen.right(144)
pen.end_fill()
pen.hideturtle()
turtle.done()
#玩家出拳
player= input("请出拳(石头/剪刀/布)")
print("玩家出拳:"+player)
#计算机出拳
import random
list=["石头","剪刀","布"]
computer=random.choice(list)
print("计算机出拳:"+computer)
#显示结果
if player in list:
if player==computer:
print("平局")
elif(player=="石头"and computer=="剪刀")or(player=="剪刀"and computer=="布")or(player=="布"and computer=="石头"):
print("恭喜,你赢了")
else:
print("很遗憾,你输了")
print("输入错误!")
\ No newline at end of file
import turtle
#祝福语
screen = turtle.Screen()
screen.bgcolor("light blue")
pen = turtle.Pen()
pen.penup()
pen.goto(100,-100)
pen.write("Hi,诺依\n用python写电子贺卡真的太方便啦\n我也喜欢python\n--悟空",font=("Times",30,"normal"))
pen.hideturtle()
#turtle.done()
#画爱心
pen1 = turtle.pen()
len = screen.textinput("提示""你想要多大的爱心")
lovsize = int(len)
pen1.left(45)
pen1.forward(2*lovsize)
pen1.circle(lovsize,180)
pen1.right(90)
pen1.circle(lovsize,180)
pen1.forward(2*lovsize)
pen1.hideturtle()
turtle.done()
import turtle
screen= turtle.Screen()
screen.bgcolor("light blue")
pen= turtle.Pen()
pen.penup()
goto(100,-100)
pen.write("Hi,诺依\n 用python写电子贺卡真的太有趣啦\n 我也喜欢python。--悟空",font=("Times",18,"normal"))
pen.hideturtle()
#turtle.done()
pen1=turtle.Pen()
len=screen.textinput("提示""你想要画多大的爱心呀!")
lovesize=int(len)
pen1.pensize(5)
pen1.pencolor("red")
pen1.left(45)
pen1.forward(2*lovesize)
pen1.circle(lovesize,180)
pen1.right(90)
pen1.circle(lovesize,180)
pen1.forward(2*lovesize)
turtle.done()
\ No newline at end of file
i=3
username = "python"
userpassword = "123456"
while True:
if i>0:
name = input("请输入你的用户名")
password = input("请输入你的密码")
i-=1
if name==username and password==userpassword:
print("登录成功!")
break
if name!=username:
print("用户名错误,请重新输入!")
print("温馨提示:你还有"+str(i)+"次登录机会")
continue
if password!=userpassword:
print("密码错误,请重新输入!")
print("温馨提示:你还有"+str(i)+"次登录机会")
else:
print("你的账户被锁住,请一个小时后再来!")
exit()
print("欢迎来到贝尔编程")
\ No newline at end of file
import turtle
screen=turtle.Screen()
screen.bgcolor("light blue")
pen = turtle.Pen()
pen.penup()
pen.goto(100,-100)
pen.write("Hi,诺依\n用python写电子贺卡真的太方便了\n我也喜欢python\n--悟空",font=("Times",30,"normal"))
pen.hideturtle()
#turtle.done()
len=screen.textinput("提示:""你想要多大爱心")
lovesize=int(len)
pen1=turtle.Pen()
pen1.pensize(5)
pen1.pencolor("red")
pen1.left(45)
pen1.forward(2*lovesize)
pen1.circle(lovesize,180)
pen1.right(90)
pen1.circle(lovesize,180)
pen1.forward(2*lovesize)
pen1.hideturtle()
turtle.done()
import turtle
pen = turtle.Pen()
#black:黑色,green:绿色,blue:蓝色,yellow:黄色,purple:紫色,white:白色,red:红色
colors=["red","orange","yellow","green"]
for i in range(1,300):
pen.forward(i)
pen.pencolor(colors[i%4])
pen.right(91)
pen.hideturtle()
turtle.done()
\ No newline at end of file
for i in range(1,10):
for j in range(1,i+1):
print(j,'*',i,'=',(j*i),end=" ")
print()#print(end=" \n ")
\ No newline at end of file
import turtle
pen = turtle.Pen()
colors=["red","orange","yellow","green"]
for i in range(1,300):
pen.forward(i)
pen.pencolor(colors[i%4])
pen.right(91)
pen.hideturtle()
turtle.done()
\ No newline at end of file
i = 3
username = "python"
userpassword = "123456"
while True:
if i>0:
name = input("请输入用户名")
password = input("请输入密码")
i-=1 #等值i=i-1
if name == username and password == userpassword:
print("登录成功")
break
if name != username:
print("用户名错误,请重新输入")
print("温馨提示:你还有"+str(i)"次登录机会")
continue
if password != userpassword:
print("密码错误,请重新输入")
print("温馨提示:你还有"+str(i)"次登录机会")
else:
print("你的账户已经被锁住,请一个小时后再试!")
print("欢迎来到贝尔世界!")
\ No newline at end of file
bro1="刘备"
bro2="关羽"
bro3="张飞"
bros = ["刘备","关羽", "张飞"]
bro1=["刘备",161,9.1]
bro2=["关羽",160,8.5]
bro3=["张飞",166,8.3]
bros[0] = "关羽"
bros[1] = "刘备"
print(bros)
b=['袁术','夏侯惇','曹操','关羽']
#b.remove('关羽')
b.pop(3)
print(b)
\ No newline at end of file
a=['华雄']
a.insert(1, '关羽')
print(a)
a= ['华雄']
c=['颜良','文丑']
a.extend(c)
print(a)
\ No newline at end of file
a=['吕布']
b=['袁术','公孙瓒','关羽','张飞','刘备','曹操']
a.extend(b[2:5])
print(a)
\ No newline at end of file
name='刘强'
power=66
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
for i in range(len(hero)):
if i%2==1 and hero[i]>=power:
hero.insert(i-1,name)
hero.insert(i,power)
break
print(hero)
name=input('你叫啥名啊?')
power=int(input('你臂力多少啊?'))
# 归档处
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98,'张宇',100]
for i in range(len(hero)):
if i%2==1 and hero[i]>=power:
hero.insert(i-1,name)
hero.insert(i,power)
break
print(hero[-6:])
i = 3
username = "python"
userpassword = "1234546"
while True:
if i>3:
name = input("请输入用户名")
password = input("请输入密码")
i=i+1
if name==username and password==userpassword:
print("登录成功"
break
if name != username:
print("用户名错误,请重新输入")
print("温馨提示:你还有"+str(i)+"次机会")
continue
if password !=userpassword:
print("用密码错误,请重新输入")
print("温馨提示:你还有"+str(i)+"次机会")
else:
print("你的账户已经被锁住,请一个小时后再试")
exit()
print("欢迎来到贝尔世界!")
students = ["悟空", "小贝", "八戒", "波奇"]
# 八戒因为要回老家,转学了,请将八戒从班级列表名单中删除
students.remove("八戒")
print(students)
# 班上来了一个新同学,名叫"诺依",请将"诺依"加入到班级名单里面
students.append("诺依")
print(students)
# 班上准备开始辩论赛,分为红(red)、蓝(blue)组,
# 请用切片将班级列表的前2名加入到红组,后2名加入到蓝组
red = students[:2]
blue = students[2:]
print(red)
print(blue)
# 需要进行加密的语句
message = "诺依,周末一起去看动漫展吧!"
# 请对message进行遍历,取出所有元素
for i in message:
print(i)
# 需要进行加密的语句
message = "诺依,周末一起去看动漫展吧!"
# 请对message进行遍历,取出所有元素
length = len(message)
i = 0
while i < length:
element = message[i]
print(element)
i += 1
import random
# 私钥
key = "abcdefgh使用编程实现位移替换加密,制作密码机关真是太好玩了哈哈!"
# 要加密语句
#message = "诺依,周末一起去看动漫展吧!"
message = input("请输入:")
# 加密后的语句(密文)
key_message = ""
# 干扰字符
noise = "port:@#$%^&"
# 加密过程
for i in message:
str1 = i
str2 = random.choice(key)
str3 = random.choice(key)
text = str1+str2+str3
key_message = key_message + text
list_message = list(key_message)
index = random.randint(0, len(key_message))
list_message.insert(index, noise)
result_message = "".join(list_message)
print(result_message)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment