파이썬 문장 속 사용된 단어와 횟수 알아내는 프로그램 만들기

조회수 623회

▶ 다음 영어 문장에 2회 이상 사용된 단어와 사용 횟수를 표시하는 프로그램을 작성하세요.

Once when I was six years old I saw a magnificent picture in a book, called True Stories from Nature, about the primeval forest. It was a picture of a boa constrictor in the act of swallowing an animal. Here is a copy of the drawing. In the book it said: "Boa constrictors swallow their prey whole, without chewing it. After that they are not able to move, and they sleep through the six months that they need for digestion."

  • 해당 문장은 임의의 변수에 문자열로 저장한 후 실행되도록 하세요. 예: msg = ‘Once when ................... digestion."’
  • 외부 라이브러리를 사용하지 마시오 힌트 : replace(), lower(), split(), for, if, 리스트, 딕셔너리 등
  • 문장 중 다음 기호들은 공백으로 변경한 후 처리하세요. (제외기호 : .(마침표) ,(쉼표) "(큰따옴표) :(콜론) ) (힌트 : replace() 함수 이용)
  • 문장의 대소문자를 구별하지 않도록 문장을 소문자로 변경한 후 처리하세요.
  • 문장 중 다음 단어들은 제외되도록 처리하세요. (제외단어 : i, was, a, in, from, it, of, the, is, in, are, not, and, for, to) (힌트 : in 연산자와 리스트 or 튜플 등 적당한 데이터 형)
  • (•́ ✖ •̀)
    알 수 없는 사용자

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)