[BOJ] 32978. 아 맞다 마늘

레몬커드요거트·2025년 10월 7일

코딩테스트준비

목록 보기
11/66
post-thumbnail
# https://www.acmicpc.net/problem/32978
# 아맞다마늘

import sys
input = sys.stdin.readline

n = int(input())

ingredients = list(input().split())
put_ingredients = list(input().split())

for i in put_ingredients:
  ingredients.remove(i)

print(ingredients.pop())

1트 실패 요인

그냥 ingredients로 해서 list그자체가 나옴

→ 리스트 요소를 pop하여 print하는 방식으로 수정

리스트의 요소를 한 번에 출력하는 방식 print(*ingredients)도 있다고 함

++++strip과 split의 역할이 헷갈림 공부해야할 듯

  • strip: 개행문자 제거
  • split: ()안의 단위로 쪼개어 리스트에 저장
profile
비요뜨 최고~

0개의 댓글