My Python program is:
def remove(duplicate):
final_list=[]
for num in duplicate:
if num not in final_list:
final_list.append(num)
return final_list
duplicate=input()
print(remove(duplicate),end="")
It's simple, you are printing the entire list, wich output is the [] and the commas. You just have to print each element separately Like:
for elem in remove(duplicate):
print(elem, end=" ")
您可以使用str.join
将列表转换为以空格分隔的字符串作为输出:
print(' '.join(remove(duplicate)),end="")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.