Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions fugitives.py
Original file line number Diff line number Diff line change
@@ -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()