t=int(input())
list=list(map(int,input().split()))
d_n=int(input())
#for i in range(t):
while d_n in list: # 这步关键!
list.remove(d_n)
for each in list:
print(each,end=" ")
- while 关键, in list的话就一直执行
- list.remove(值)——很方便
t=int(input())
list=list(map(int,input().split()))
d_n=int(input())
#for i in range(t):
while d_n in list: # 这步关键!
list.remove(d_n)
for each in list:
print(each,end=" ")