python/연습장
가위바위보 게임
joo_coding
2025. 2. 21. 17:16
#가위바위보 게임
#1번 플레이어가 가위,바위,보 하나를 입력
#2번 플레이어가 가위,바위,보 하나를 입력
#최종적으로 1번과 2번이 각각 무엇을 냈는지 보여주고
#어떤 플레이어가 이겼는지 알려주는 게임
player_1 = input("1번 선수! 가위,바위,보!:")
player_2 = input("2번 선수! 가위,바위,보!:")
sci = "가위"
stone = "바위"
hand = "보"
sci < stone
stone < hand
hand < sci
# 가위<바위
# 바위<보
# 보<가위
if player_1 == "가위":
print("1번 선수가 가위를 냈습니다.")
elif player_1 == "바위":
print(stone)
elif player_1 == "보":
print(hand)
if player_2 == "가위":
print(sci)
elif player_2 == "바위":
print(stone)
elif player_2 == "보":
print(hand)
#승부결과
#1번이 가위를 냈을 때
print
if player_1 == sci and player_2 == sci:
print("비겼습니다.")
elif player_1 == sci and player_2 == stone:
print("2번 선수가 이겼습니다.")
elif player_1 == sci and player_2 == hand:
print("1번 선수가 이겼습니다.")
#1번이 바위를 냈을 때
print
if player_1 == stone and player_2 == sci:
print("1번 선수가 이겼습니다.")
elif player_1 == stone and player_2 == stone:
print("비겼습니다.")
elif player_1 == stone and player_2 == hand:
print("2번 선수가 이겼습니다.")
#1번이 보를 냈을 때
print
if player_1 == hand and player_2 == sci:
print("2번 선수가 이겼습니다.")
elif player_1 == hand and player_2 == stone:
print("1번 선수가 이겼습니다.")
elif player_1 == hand and player_2 == hand:
print("비겼습니다.")