import random 
def get_user_choice(): 
    choice = input("가위, 바위, 보 중 하나를 선택하세요: ").strip().lower() 
    if choice not in ["가위", "바위", "보"]: 
        print("올바른 선택이 아닙니다. 다시 시도하세요.") 
        return get_user_choice() 
    return choice 
def get_computer_choice(): 
    choices = ["가위", "바위", "보"] 
    return random.choice(choices) 
def determine_winner(user_choice, computer_choice): 
    if user_choice == computer_choice: 
        return "무승부" 
    elif ( 
        (user_choice == "가위" and computer_choice == "보") or 
        (user_choice == "바위" and computer_choice == "가위") or 
        (user_choice == "보" and computer_choice == "바위") 
    ): 
        return "사용자 승리" 
    else: 
        return "컴퓨터 승리" 
def main(): 
    print("가위 바위 보 게임을 시작합니다.") 
    while True: 
        user_choice = get_user_choice() 
        computer_choice = get_computer_choice() 
        print(f"사용자: {user_choice}, 컴퓨터: {computer_choice}") 
        result = determine_winner(user_choice, computer_choice) 
        print(f"결과: {result}") 
         
        play_again = input("다시 하시겠습니까? (y/n): ").strip().lower() 
        if play_again != "y": 
            print("게임 종료") 
            break 
if __name__ == "__main__": 
    main() 
| with open(file_path, 'r', encoding='utf-8') as file: (0) | 2023.08.26 | 
|---|---|
| def generate_random_matrix(): (0) | 2023.08.26 | 
| 19*19 단을 출력하는 파이썬 코드 (0) | 2023.08.24 | 
| def generate_lotto_numbers(): 로또번호 생성 (0) | 2023.08.24 | 
| def naver_shopping_search(query) (0) | 2023.08.24 |