Commit 34648249 by BellCodeEditor

save project

parent 5265ca6b
Showing with 33 additions and 0 deletions
'''
name=["John","Sam","Lily","Anna","Daming","Hellen"]
name[2]="nina"
name.insert(5,"Sally")
name.pop(3)
print(name)
'''
fruit=["apple","banana","apple","cherry", "apple","orange"]
fruit.pop(0)
print(fruit)
fruit=["apple","banana","apple","cherry", "apple","orange"]
fruit.pop(-6)
print(fruit)
fruit=["apple","banana","apple","cherry", "apple","orange"]
for i in range(3):
fruit.remove("apple")
fruit.insert(2,"peach")
print(fruit)
fruit=["apple","banana","apple","cherry", "apple","orange"]
fruit.append("peach")
print(fruit)
fruit=["apple","banana","apple","cherry", "apple","orange"]
fruit.extend(["peach"])
print(fruit)
fruit=["apple","banana","apple","cherry", "apple","orange"]
fruit.insert(-4,"peach")
print(fruit)
name=["John","Sam","Daming","Sally","Hellen"]
name.extend(["Xiaoli", "qiang","Neo"])
sub_name=name[2:6]
print(name)
print(sub_name)
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