Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

bellcode / lesson13-1

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 011b357d authored 4 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

auto save

parent cba07db5
Hide whitespace changes
Inline Side-by-side
Showing with 51 additions and 118 deletions
  • 1/1.py
  • 11.py
  • a.py
  • b.py
  • d.py
  • diy.py
  • e.py
  • game.py
  • sales_list.txt
  • sum.py
1/1.py 0 → 100644
View file @ 011b357d
with open(r'c:\Users\tang\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines()
#print(a)
res = 0
f_s=[]
for i in a:
data= i.split()
#print(data[1:])
sum=0
for sales in data[1:]:
sum=sum+int(sales)
res += sum
result=data[0]+str(sum)+"\n"
f_s.append(result)
print(result)
print(res)
# with open(r'c:\Users\tang\Documents\lesson13-1\sales_list.txt','a',encoding='utf-8') as file:
# a=file.writelines()
\ No newline at end of file
This diff is collapsed. Click to expand it.
11.py 0 → 100644
View file @ 011b357d
with open(r'c:\Users\tang\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines()
# print(a)
for i in a:
data = i.split()
# print(data)
sum = 0
# print(data[1:])
for sales in data[1:]:
sum += int(sales)
result = data[0]+str(sum)
print(result)
This diff is collapsed. Click to expand it.
a.py deleted 100644 → 0
View file @ cba07db5
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
This diff is collapsed. Click to expand it.
b.py deleted 100644 → 0
View file @ cba07db5
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
This diff is collapsed. Click to expand it.
d.py deleted 100644 → 0
View file @ cba07db5
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("请重新输入")
This diff is collapsed. Click to expand it.
diy.py
View file @ 011b357d
...@@ -2,9 +2,21 @@ ...@@ -2,9 +2,21 @@
# # 打开文件有两种写法: # # 打开文件有两种写法:
# # 方法一: # # 方法一:
# # file=open(r'c:\Users\tang\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') # # file=open(r'c:\Users\tang\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')
# # 方法二:(注意结尾的英文冒号) # # 方法二:(注意结尾的英文冒号)
# 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.read()
print(a)
# # for i in a: #for循环吧每一行的数据遍历 # # for i in a: #for循环吧每一行的数据遍历
# # data = i.split() #把字符串切割成更细的小字符串 # # data = i.split() #把字符串切割成更细的小字符串
......
This diff is collapsed. Click to expand it.
e.py deleted 100644 → 0
View file @ cba07db5
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
This diff is collapsed. Click to expand it.
game.py deleted 100644 → 0
View file @ cba07db5
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("")
This diff is collapsed. Click to expand it.
sales_list.txt
View file @ 011b357d
悟空 12 15 11 12 11 12 13 21 27 12 15 30 22 26 15 12 21 23 27 11 悟空 12 15 11 12 11 12 13 21 27 12 15 30 22 26 15 12 21 23 27 11
诺依 21 29 15 21 21 21 29 30 12 13 12 12 24 52 27 26 15 诺依 21 29 15 21 21 21 29 30 12 13 12 12 24 52 27 26 15
小贝 29 11 11 15 13 15 13 11 11 29 13 11 小贝 29 11 11 15 13 15 13 11 11 29 13 11
......
This diff is collapsed. Click to expand it.
sum.py deleted 100644 → 0
View file @ cba07db5
#导入模块
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
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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