Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- play = True
- while play :
- #player_choice
- player = input("Enter your choice (바위/보/가위): ")
- player = player.lower()
- while (player != "바위" and player != "보" and player != "가위"):
- player = input("Enter your choice (바위/보/가위): ")
- player = player.lower()
- #computer_random
- computer = random.randint(1,3)
- if (computer == 1):
- computer = "바위"
- elif (computer == 2):
- computer = "보"
- elif (computer == 3):
- computer = "가위"
- else:
- print ("Error. Enter your choice from 바위, 보, 가위.")
- #result
- if (player == computer):
- print ("비겼다!")
- elif (player == "바위"):
- if (computer == "보"):
- print ("너가 이겼다");
- if (computer == "가위"):
- print ("너가 졌다.");
- elif (player == "보"):
- if (computer == "바위"):
- print ("너가 이겼다.");
- if (computer == "가위"):
- print ("너가 졌다.");
- elif (player == "가위"):
- if (computer == "바위"):
- print ("너가 졌다.");
- if (computer == "보"):
- print ("너가 이겼다.");
- #restart
- userInput = input("게임끝낼래 ? Yes or No: ")
- userInput = userInput.lower()
- if (userInput == "yes"):
- play = False
- print ("다음에 또만나요")
- else:
- play = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement