File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 442 . player_input()
55> 플레이어에게 3개의 숫자 입력 받는 기능 함수 추가 (2025/02/05)
663 . check_input()
7- > 플레이어가 입력한 숫자에 대한 결과를 출력하는 함수 추가 (2025/02/05)
7+ > 플레이어가 입력한 숫자에 대한 결과를 출력하는 함수 추가 (2025/02/05)
8+ 4 . loop_check()
9+ > 1에서 3까지의 과정을 반복해 3개의 숫자를 모두 맞히면 게임이 종료되는 기능 함수 추가 (2025/02/05)
Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ def check_input(get, com):
2727 return "{0}볼" .format (ball )
2828 else :
2929 return "{0}볼 {1}스트라이크" .format (ball , strike )
30+
31+ def loop_check (com ):
32+ get = player_input ()
33+ result_check_input = check_input (get , com )
34+ print (result_check_input )
35+ if result_check_input != "3스트라이크" :
36+ loop_check (com )
3037
3138def main ():
3239 """
@@ -36,8 +43,9 @@ def main():
3643 # 프로그램의 메인 로직을 여기에 구현
3744 print ("숫자 야구 게임을 시작합니다." )
3845 computer = make_computer_num ()
39- get = player_input ()
40- print (check_input (get , computer ))
46+ print (computer )
47+ loop_check (computer )
48+ print ("3개의 숫자를 모두 맞히셨습니다! 게임 종료" )
4149
4250if __name__ == "__main__" :
4351 # 프로그램이 직접 실행될 때만 main() 함수를 호출
You can’t perform that action at this time.
0 commit comments