Commit 9e2c7358 by BellCodeEditor

auto save

parent da808c4c
Showing with 63 additions and 4 deletions
...@@ -4,4 +4,53 @@ ...@@ -4,4 +4,53 @@
#这时还是无名小卒的关羽上前请战,请从b列表中删掉“关羽”,用三种方法哦。 #这时还是无名小卒的关羽上前请战,请从b列表中删掉“关羽”,用三种方法哦。
b=['袁术','夏侯惇','曹操','关羽'] b=['袁术','夏侯惇','曹操','关羽']
b.pop(3) b.pop(3)
\ No newline at end of file print(b)
b=['袁术','夏侯惇','曹操','关羽']
b.pop(-1)
print(b)
b=['袁术','夏侯惇','曹操','关羽']
b.remove("关羽")
print(b)
a=["华雄"]
#a.insert(1,"关羽")
a.append("关羽")
print(a)
a=["华雄"]
b=["颜良","文丑"]
a.extend(b)
print(a)
a=["吕布"]
b=["袁术","公孙瓒","刘备","关羽","张飞","曹操"]
a.extend(b[2:5])
print(a)
name=input("你叫啥?")
power=int(input("你有多少臂力"))
hero=["赵一",30,"丁二",37,"孙五",52,"王猛",89,"周亮",98]
for i in range(len(hero)):
if i%2==1 and hero[i]>=power:
hero.insert(i-1,name)
hero.insert(i,power)
break
print(hero)
# 勇于挑战的创造师,请运行以下代码,看看能不能删掉水果列表中的香蕉,运行结果是什么呢? # 勇于挑战的创造师,请运行以下代码,看看能不能删掉水果列表中的香蕉,运行结果是什么呢?
list=['苹果','香蕉','西瓜','香蕉','桃子','香蕉'] list=['苹果','香蕉','西瓜','香蕉','桃子','香蕉']
list.remove('香蕉') list.remove('香蕉')
print(list) print(list)
\ No newline at end of file
b=['袁术','夏侯惇','曹操','关羽']
b.pop(3)
#b=['袁术','夏侯惇','曹操','关羽']
#b.pop(-1)
#b=['袁术','夏侯惇','曹操','关羽']
#b.remove("关羽")
\ 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