From 7850c609c14a11cec7e9e3fa54f520d8387ece3a Mon Sep 17 00:00:00 2001 From: Naidraug0 Date: Tue, 2 May 2023 14:46:34 +0900 Subject: [PATCH] =?UTF-8?q?Feature:=20=ED=95=A8=EC=88=98=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84%push=20=EC=97=B0=EC=8A=B5=20=EC=B2=AB=EB=B2=88?= =?UTF-8?q?=EC=A7=B8=EC=9E=85=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fugitives.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 fugitives.py diff --git a/fugitives.py b/fugitives.py new file mode 100644 index 0000000..0f4bd3d --- /dev/null +++ b/fugitives.py @@ -0,0 +1,34 @@ +## 함수 만들기, 구현 연습 + +def main(): + while True: + print("\nBulls and Cows 게임을 시작합니다.") + ans = gen_game() + tries, endmsg = 1, f"Game Over. 정답: {ans}" + while tries < 11: + gss = input("맞춰보세요(4자리 숫자): ") + if not chk_gss(gss): + continue + result, stat = get_result(ans, gss) + if result == True: + endmsg = f"정답입니다. 총 입력한 횟수: {tries}" + break + else: + print(f"결과는 {stat}입니다. 총 입력한 횟수: {tries}") + tries += 1 + print(endmsg) + + while True: + retry = input("다시 시작할까요([0] 아니오, [1] 예)? ") + if retry == "0": + exit() + elif retry == "1": + break + else: + print("잘못된 입력입니다.") + continue + + +if __name__ == "__main__": + main() +