Commit 234b724b by BellCodeEditor

save project

parent 529f4d8a
import turtle
pen=turtle.Pen()
pen.fillcolor("red")
pen.begin_fill()
for i in range(5):
pen.forward(200)
pen.right(144)
pen.end_fill()
turtle.dome()
import time
d=time.time()
list1=[]
print('开始时间为:',d)
for a in range(0,1001):
for b in range(0,1001):
list1.append(0)
e=time.time()
print('共用时',str(e-d))
\ No newline at end of file
a=[20,17,9,13,5,6]
n=len(a)
for i in range(0,5):
for j in range(0,5):
if a[j]>a[j+1]:
a[j],a[j+1]=a[j+1],a[j]
print(a)
# a = 10
# b = 5
# c = 0
# c = a
# a = b
# b = c
# print(a,b)
\ No newline at end of file
# 持家小能手 (利用自动更新成绩程序的逻辑完成这个新项目)
# 如果输入的水果价钱比字典中的低,则替换掉,反之则不更新
cost= {'苹果':43,'山竹':12,'香蕉':2,'荔枝':15,'葡萄':9,'桂圆':8,'蓝莓':10,'李子':8}
k=input('请输入水果名称:')
v=input('请输入水果价钱:')
if k in v :
if int (v)>k# ?更新价钱
print(k+'降价了,现价'+v+'元')
else:
print(k+'涨价了,我们不买')
else:
cost[k] = float(v)
print(k+'的价钱'+v+'元已上传~')
1.print(0) #输出打印 在控制台输出内容
2.连接符+(字符串+字符串)=一整个字符串
3.整形+整型=相加的功能
例子 100+200=300
4.整形+字符串=会报错,类型错误
5.type()查看数据类型
int是整型 str是字符串 float浮点数 bool布尔值
6.turtle 画图模块 import turtle 引入画图模块,一定要在代码的第一行
7.turtle.pen()创建一支画笔
8.turtle.done()保存画布,一定要写在代码末尾
9.pen.shape('形状')设置画笔的形状
import turtle
pen=turtle.Pen()
for i in range(5):
pen.forward(200)
pen.right(144)
pen.hideturtle(ryh6j67dfnjhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaq)``
turtle.done()
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