Commit 4a459be1 by BellCodeEditor

save project

parent 51e3ca9b
Showing with 3 additions and 68 deletions
# def new_input():
# total = []
# while True:
# unit= input("请输入(q退出):")
# if unit== 'q':
# break
# else:
# try:
# unit=int(unit)
# except:
# print("数字")
# else:
# total.append(unit)
# return total
# def sum(unit):
# j=0
# for i in unit:
# j=j+i
# return j
# result= new_input()
# pay=sum(result)
# print("你消费了"+str(pay)+"元")
import func
d=func.new_input()
s=func.sum(d)
print("这个人的总分是"+str(s))
\ No newline at end of file
...@@ -2,4 +2,5 @@ a= open(r"C:\Users\Lenovo\Desktop\yty\yty.txt",'r',encoding='utf-8') ...@@ -2,4 +2,5 @@ a= open(r"C:\Users\Lenovo\Desktop\yty\yty.txt",'r',encoding='utf-8')
b=a.readlines() b=a.readlines()
print(b) print(b)
for i in b: for i in b:
print(i) c=i.split()
\ No newline at end of file print(c[0])
\ No newline at end of file
def new_input():
total = []
while True:
unit= input("请输入(q退出):")
if unit== 'q':
break
else:
try:
unit=int(unit)
except:
print("数字")
else:
total.append(unit)
return total
def sum(unit):
j=0
for i in unit:
j=j+i
return j
result= new_input()
pay=sum(result)
print("你得了"+str(pay)+"分")
# import func
# d=func.new_input()
# s=func.sum(d)
# print("这个人的总分是"+str(s))
\ No newline at end of file
try:
age=int(input('你今年几岁?'))
except:
print('输入数字')
else:
if age<18:
print('不可以色色')
print('滚')
\ 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