1052. 卖个萌 (20)--Python

来源:互联网 发布:母婴店软件 编辑:程序博客网 时间:2024/06/14 18:51

虽然自己跑着没问题,但是测试总说返回为零,应该是程序炸了,先记录下来,然后再改。

def get_list(a):a = ''.join(a.split())list_1 = list(a)list_2 = []length = len(list_1)#print(list_1)while list_1:i = 0if list_1[i] == '[':flag = ''list_1.pop(i)#print(list_1)j = 0while list_1[j] != ']':flag += list_1[j]j += 1#print(flag)list_2.append(flag)list_1.pop(j)list_1 = list_1[j:]i += 1return list_2a = input()b = input()c = input()num = input()num = int(num)list_hand = get_list(a)list_eye = get_list(b)list_mouth = get_list(c)length_hand = len(list_hand)length_eye = len(list_eye)length_mouth = len(list_mouth)for i in range(num):my_flag_list = ''flag = Falselist = input().split()for n in list:if n <= '0':flag = Truehand_left = int(list[0])eye_left = int(list[1])mouth = int(list[2])eye_right = int(list[3])hand_right = int(list[4])if (hand_left > length_hand):flag = Trueif (hand_right > length_hand):flag = Trueif (eye_left > length_eye):flag = Trueif (eye_right > length_eye):flag = Trueif (mouth > length_mouth):flag = Trueif flag == False:my_flag_list = list_hand[int(list[0]) -1] + '(' + list_eye[int(list[1]) - 1] + list_mouth[int(list[2]) - 1] + list_eye[int(list[3]) - 1] + ')' +list_hand[int(list[4]) -1]else:my_flag_list = 'Are you kidding me? @' + '\\' + '/@'print(''.join(my_flag_list))


原创粉丝点击