python raise1 #Python - 35. 파이썬 raise raise를 이용해 예외를 직접 발생시켜 수를 맞추는 게임(UP, DOWN)을 만들어봤습니다. import random answer = random.randint(1, 10) print('UP DOWN 게임을 시작합니다.(1~10) 3번의 기회!') print('정답: ', answer) count = 0 try: while True: try: choice = input('수 입력>') choice = int(choice) if choice < 1 or 10 < choice: print('1~10 정수 입력...') continue else: if choice == answer: print('정답입니다!\n정답={}\n입력한 수={}'.format(answer, choice)) raise StopIter.. 2020. 2. 13. 이전 1 다음