nametoRemove = input("Enter the name you want to remove:")
print(nametoRemove)
name = ["Ramesh","Rakesh","Suresh"]
name.remove(nametoRemove)
print(name)
答案 0 :(得分:0)
您可以使用for循环和if语句进行基本设置
nametoRemove = input("Enter the name you want to remove:")
print(nametoRemove)
name = ["Ramesh","Rakesh","Suresh"]
for item in name:
if item.lower() == nametoRemove.lower():
name.remove(item)
print(name)
输出:
Enter the name you want to remove:ramesh
ramesh
['Rakesh', 'Suresh']