python/조건문

가위바위보 게임2

june__Park 2021. 2. 16. 22:03
# 가위바위보 게임
# 1. com은 0~2 사이의 랜덤한 숫자를 저장한다.
# 2. me는 0~2 사이의 숫자를 입력받는다.
# 3. com과 me를 비교해,
# 		1) 비겼다.
# 		2) 내가 이겼다.
# 		3) 내가 졌다.			를 출력한다.

import random

com = random.randint(0, 2)

print("치트키 =", com)

me = int(input("가위(0),바위(1),보(2) 입력 : "))

if com == me:
    print("비겼다.")
if com == 0 and me == 1:
    print("이겼다.")
if com == 1 and me == 2:
    print("이겼다.")
if com == 2 and me == 0:
    print("이겼다.")
if com == 0 and me == 2:
    print("졌다.")
if com == 1 and me == 0:
    print("졌다.")
if com == 2 and me == 1:
    print("졌다.")