yanbo long

Generation

generate functionSat, 08 Apr 2023

输入格式是 W1=input() W2=input() 将两个数列的数据的差 然后按升序排列 结果用"[""]"括起来 每个数据之间加","

def fun(W1, W2): W1 = list(map(int, W1.split())) W2 = list(map(int, W2.split())) str1 = "" for i in W1: if i not in W2: str1 = str1 + str(i) + " " str1 = str1.strip() str2 = "" for i in W2: if i not in W1: str2 = str2 + str(i) + " " str2 = str2.strip() str1 = str1.split() str2 = str2.split() str1.sort() str2.sort() str1 = [int(i) for i in str1] str2 = [int(i) for i in str2] str1 = "[" + str(str1)[1:len(str(str1)) - 1] + "]" str2 = "[" + str(str2)[1:len

Questions about programming?Chat with your personal AI assistant