Commit ae7de042 by BellCodeEditor

auto save

parent b06290e9
#第一步 导入turtle模块
import turtle as t
#第二步 画笔颜色红色
t.pencolor('red')
#第三步 画正方形
for i in range(4):
t.forward(100)
t.right(90)
#第四步 保存画布
t.done()
\ No newline at end of file
# import tkinter
# def register():
# name = e1.get()
# password1 = e2.get()
# password2 = e3.get()
# print("用户输入的信息为:",name,password1,password2)
# dict={}
# dict[name]=password1
# with open('user.txt','w',encoding='utf-8') as f:
# f.write(str(dict))
# # 建立窗口对象
# root = tkinter.Tk()
# root.title("注册") # 设置窗口标题
# root.geometry("400x320+500+300") # 设置窗口大小
# root.resizable(width=False, height=False) # True可以拉伸,False不能拉伸
# # 输入框entry;用户输入框
# e1 = tkinter.Entry(root,show=None,font=('宋体',14),bg="light grey",width=18) # 显示成明文形式
# e1.place(x=140, y=80)
# # 密码输入框,左上角坐标:x:140,y:140
# e2 = tkinter.Entry(root, show='*', font=('宋体', 14), width=18)
# e2.place(x=140, y=140)
# # 确认密码输入框,左上角坐标:x:140,y:200
# e3 = tkinter.Entry(root, show='*', font=('宋体', 14), width=18)
# e3.place(x=140, y=200)
# # 注册界面上的文字标签
# lab = tkinter.Label(root, text='您好!请填写注册信息', font=('宋体', 15),
# fg="black",width=40, height=2,bg="green")
# lab.place(x=0,y=0)
# # 在输入框前展示文字标签:用户名:、密 码:、确认密码:
# lab1 = tkinter.Label(root, text='用户名:', font=("宋体", 12), fg="black")
# lab1.place(x=60, y=80)
# lab2 = tkinter.Label(root, text='密 码:', font=("宋体", 12), fg="black")
# lab2.place(x=60, y=140)
# lab3 = tkinter.Label(root, text='确认密码:', font=("宋体", 12), fg="black")
# lab3.place(x=50, y=200)
# # 提交按钮;
# button = tkinter.Button(root, text='提交', bg="lightgreen",width=15,
# command=register) # fg 字体颜色
# button.place(x=150, y=250)
# # 进入消息循环
# root.mainloop()
# text='to be or not to be that is a question'
# list=text.split(' ')
# dict={}
# for i in range(len(list)):
# dict[list[i]]=list.count(list[i])
# print(dict)
# a=int(input('请输入一个数字:'))
# i=0
# while not a==1:
# if a%2==0:
# a=a//2
# else:
# a=a*3+1
# i+=1
# print(i)
import turtle
pen=turtle.Pen()
pen.pencolor('yellow')
pen.fillcolor('yellow')
pen.speed(0)
pen.begin_fill()
# for i in range(360):
# pen.forward(1)
# pen.left(1)
pen.circle(150)
pen.end_fill()
pen.penup()
pen.goto(150,0)
pen.pendown()
pen.pencolor('white')
pen.fillcolor('white')
pen.speed(0)
pen.begin_fill()
pen.circle(75)
pen.end_fill()
pen.hideturtle()
turtle.done()
\ No newline at end of file
import turtle as t
t.color('red','yellow')
t.begin_fill()
for i in range(5):
t.fd(100)
t.right(144)
t.end_fill()
t.hideturtle()
t.done()
\ No newline at end of file
import random
player=input("玩家请出拳:")
chuquan=['剪刀','石头','布']
computer=random.choice(chuquan)
# print('玩家出拳:'+player)
print('计算机出拳:'+computer)
if player in chuquan:
if player==computer:
print('平局')
elif (player=="剪刀" and computer=="石头") or (player=="石头" and computer=="布") or (player=="布" and computer=="剪刀"):
print('计算机胜利')
else:
print('恭喜你赢了。')
else:
print('请重新输入。')
#1.玩家出拳,保存到player变量里
player=input('玩家请出拳:')
#2.计算机随机出拳
import random
list=['剪刀','石头','布']
computer=random.choice(list)
#3.判断输赢
if player==computer:
print('平局')
elif player=='剪刀' and computer=='布':
print('恭喜你赢了')
elif player=='石头' and computer=='剪刀':
print('恭喜你赢了')
elif player=='布' and computer=='石头':
print('恭喜你赢了')
else:
print('你输了')
print('玩家出拳'+player)
print('计算机出拳'+computer)
\ No newline at end of file
day=input('今天星期几?')
if day=='星期一':
print('今天学钢琴')
elif day='星期三':
print('今天学编程')
elif day=='星期六':
print('今天学英语')
else:
print('今天学国学')
\ No newline at end of file
username='fcx'
userpassword='woshidashuaige'
i=3
while True:
if i>0:
name=input('请输入用户名:')
password=input('请输入密码:')
i=i-1
if name==username and password==userpassword:
print('登陆成功')
break
elif name!=username:
print('用户名错误')
elif password!=userpassword:
print('密码错误')
print('你还有'+str(i)+'次登陆机会。')
print('欢迎来到贝尔编程')
\ No newline at end of file
for j in range(1,10):
for i in range(1,j+1):
print(i,'x',j,'=',j*i,end=' ')
print()
\ No newline at end of file
# 期末考试结束了,悟空在教务系统查到了自己的几门必修课分数,他想通过python计算自己的平均分。
# 于是写了下面的代码,可是总是得不到结果,请帮纠正bug并跑通程序。
scores = {'语文':89, '数学':95, '英语':80}
def get_average(scores):
score = 0
for subject, score in scores.items():
score += score
print('现在的总分是%d'%score)
ave_score = score/len(scores)
print('平均分是%d'%ave_score)
get_average(scores)
\ No newline at end of file
list=list(range(0,101))
def search(alist,bingo_num):
low=0
high=len(alist)-1
while low<=high:
mid=(low+high)//2
guess=alist[mid]
if guess==bingo_num:
return mid
elif guess<bingo_num:
low=mid+1
else:
high=mid-1
return None
print(search(list,13))
\ No newline at end of file
{'111': '222'}
\ No newline at end of file
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