Commit cba07db5 by BellCodeEditor

auto save

parent d7e4ad57
name="悟空"
word="你好"
print(name+word)
print(4+5)
#查看数据类型
a=1
b=1.0
c=[1,2,3]
d="你好"
print(type(a))
print(type(b))
print(type(c))
print(type(d))
\ No newline at end of file
import turtle
p = turtle.Pen()
c = input("请输入颜色:")
p.color(c)
p.shape("turtle")
p.fillcolor(c)
p.begin_fill()
for i in range(5):
p.forward(200)
p.left(144)
p.hideturtle()
p.end_fill()
turtle.done()
\ No newline at end of file
p = input("玩家输入:")
import random
list = ["石头","剪刀","布"]
c = random.choice(list)
print("计算机出拳:"+ c)
if p in list:
if p == c:
print("平局")
elif (p=="石头" and c=="剪刀") or (p=="剪刀" and c=="布") or (p=="布" and c=="石头"):
print("玩家赢")
else:
print("计算机赢")
else:
print("请重新输入")
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# # 方法二:(注意结尾的英文冒号) # # 方法二:(注意结尾的英文冒号)
# with open(r'c:\Users\tang\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file: # with open(r'c:\Users\tang\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
# a=file.readlines() # a=file.readlines()
# # for i in a: #for循环吧每一行的数据遍历 # # for i in a: #for循环吧每一行的数据遍历
# # data = i.split() #把字符串切割成更细的小字符串 # # data = i.split() #把字符串切割成更细的小字符串
# # # print(data[1:]) #打印出所需数据 # # # print(data[1:]) #打印出所需数据
......
p = input("玩家出拳:")
import random
list = ["石头","剪刀","布"]
c = random.choice(list)
print("计算机出拳"+ c)
if p in list:
if p==c:
print("平局")
elif (p=="石头" and c=="剪刀") or (p=="剪刀" and c=="布") or (p=="布" and c=="石头"):
print("玩家赢")
else:
print("电脑赢")
else:
print("请重新输入:")
\ No newline at end of file
p = input("请输入:")
import random
list = ["石头","剪刀","布"]
c = random.choice(list)
print("计算机出拳:"+ c)
if p in list:
if p == c:
print("平局")
elif (p == "石头" and c == "剪刀") or (p == "剪刀" and c == "布") or (p == "布" and c == "石头"):
print("玩家赢")
else:
print("电脑赢")
else:
print("")
#导入模块
import turtle
#改变背景颜色
turtle.Screen().bgcolor("pink")
#创建画笔
p = turtle.Pen()
#改变画笔颜色
p.color("red")
#改变画笔速度
p.speed(1000)
#抬笔
p.penup()
#改变画笔位置
# p.goto(100,150)
p.setpos(100,150)
#落笔
p.pendown()
#填充颜色
p.fillcolor("yellow")
#改变画笔形状
p.shape("circle")
#开始填充
p.begin_fill()
#画太阳花,循环36次
for i in range(36):
#移动
p.forward(200)
#旋转
p.left(170)
#结束填充
p.end_fill()
#隐藏画笔
p.hideturtle()
#保存画布
turtle.done()
\ No newline at end of file
import turtle
p = turtle.Pen()
p.shape("circle")
p.fillcolor("red")
p.begin_fill()
p.forward(100)
p.left(90)
p.end_fill()
p.hideturtle()
turtle.done()
\ 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