초성 게임
-
[python] 파이썬으로 초성 게임카테고리 없음 2022. 1. 24. 00:30
초성 게임을 파이썬으로 구현하였다. 초성 게임의 규칙은 다음과 같다. 임의로 일정 개수의 초성을 고른다. 플레이어는 차례로 초성에 맞는 단어를 말한다. 예를 들어 'ㄱㅂ'이라면 '가방', '경비' 등을 말하면 된다. 말 할 단어가 생각나지 않는다면 게임에 패배하게 된다. 코드 class lenerror(Exception): pass class againerror(Exception): pass class zaumerror(Exception): pass import random def chosung(word): try: cho_list = [] for w in range(len(word)): if (ord('가')