模块对比输出
data_str = input() patt_str = input() # print(data_str) # print(patt_str) data_list = list(map(int,data_str.split(" "))) patt_list = list(map(int,patt_str.split(" "))) result_list = [0]*len(data_list) for i in range(len(data_list)): for j in range(len(patt_list)): if data_list[i]<=patt_list[j]: result_list[i] = j break if j == (len(patt_list)-1): result_list[i] = j+1 for i in result_list: print(i, end=" ") ''' 输入: 7 9 27 126 100 255 9 25 124 252 输出: 0 0 2 3 2 4 '''