Commit 7d9a9a9b by BellCodeEditor

auto save

parent 5ec53ebb
Showing with 27 additions and 0 deletions
new_wenjian=""
with open(r"c:\Users\张颜\Desktop\word.txt","r",encoding='utf-8') as wenjian:
a=wenjian.readlines()
# print(a)
for i in a:
s=i.split()
sum=0 #求和
for n in s[1:]:
sum=sum+int(n)
new_wenjian=s[0]+str(sum) #为什么只输出了最后一个人的人名和总价
with open(r"c:\Users\张颜\Desktop\word.txt","a",encoding='utf-8') as wenjian:
wenjian.writelines(new_wenjian)
import random
a=0
b=0
c=0
d=0
e=0
a=random.randint(0,99)
b=random.randint(0,99)
c=random.randint(0,99)
d=random.randint(0,99)
e=random.randint(0,99)
print(a,"+",b,"-",c,"*",d,"/",e,"=?")#95 + 50 - 63 * 29 =? 29 + 52 - 75 * 32 =?
\ 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