Commit 4385672d by BellCodeEditor

save project

parent 481e8eda
Showing with 46 additions and 10 deletions
a=['你好呀\n','悟空\n','我在贝尔编程学python\n'] '''
with open(r'C:\Users\Administrator\Desktop\hello.txt','a',encoding='utf-8') as file: 36题
file.writelines(a) r=int(input("请输入圆的半径"))
\ No newline at end of file print("圆的直径是",2*r)
print("圆的周长是",2*r*3.14)
print("圆的面积是",r**2*3.14)
'''
import turtle as t
t.penup()
t.goto(0,-200)
t.pendown()
t.circle(200)
t.penup()
t.goto(-100,50)
t.pendown()
t.fillcolor("blue")
t.begin_fill()
t.circle(20)
t.end_fill()
t.penup()
t.goto(100,50)
t.pendown()
t.fillcolor("blue")
t.begin_fill()
t.circle(20)
t.end_fill()
t.penup()
t.goto(0,50)
with open(r'C:\Users\Administrator\Desktop\sales_list.txt','r',encoding='utf-8')as file1: with open(r'C:\Users\Administrator\Desktop\sales_list.txt','r',encoding='utf-8')as file:
a=file1.readline() a=file.readlines()
#print(a) final_sum=[]
for i in a: for i in a:
s=i.split() data=i.split()
print(s) sum=0
\ No newline at end of file for sales in data[1:]:
sum+=int(sales)
result=data[0]+str(sum)+'\n'
final_sum.append(result)
with open(r'C:\Users\Administrator\Desktop\sales_list.txt','a',encoding='utf-8')as file:
file.writelines(final_sum)
\ 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