Commit 7468b1fd by BellCodeEditor

save project

parent dc70412a
Showing with 31 additions and 0 deletions
def new_input():#先判断字母Q的情况,再判断是否输入错误
total = []
while True:
unit=input("请输入:")
if unit=='q':
break
else:
try:
unit=int(unit)
except:
print("输入错误")
else:
total.append(unit)
return total
def sum(qw):
s=0
for i in qw:
s+=float(i)
return s
list=new_input()
num=sum(list)
print(num)
\ No newline at end of file
a=list(range(10))
print(a)
a[:2]=[5]
print(a)
a.pop(5)
a.remove(5)
print(a)
\ 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