Advertisement
Guest User

rockpapersissors

a guest
Dec 11th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.46 KB | None | 0 0
  1. import random
  2. play = True
  3. while play :
  4.  
  5.     #player_choice
  6.     player = input("Enter your choice (바위/보/가위): ")
  7.     player = player.lower()
  8.     while (player != "바위" and player != "보" and player != "가위"):
  9.         player = input("Enter your choice (바위/보/가위): ")
  10.         player = player.lower()
  11.  
  12.     #computer_random
  13.     computer = random.randint(1,3)
  14.     if (computer == 1):
  15.         computer = "바위"
  16.     elif (computer == 2):
  17.         computer = "보"
  18.     elif (computer == 3):
  19.         computer = "가위"
  20.     else:
  21.         print ("Error. Enter your choice from 바위, 보, 가위.")
  22.  
  23.     #result
  24.     if (player == computer):
  25.         print ("비겼다!")
  26.     elif (player == "바위"):
  27.         if (computer == "보"):
  28.             print ("너가 이겼다");
  29.         if (computer == "가위"):
  30.             print ("너가 졌다.");
  31.     elif (player == "보"):
  32.         if (computer == "바위"):
  33.             print ("너가 이겼다.");
  34.         if (computer == "가위"):
  35.             print ("너가 졌다.");
  36.     elif (player == "가위"):
  37.         if (computer == "바위"):
  38.             print ("너가 졌다.");
  39.         if (computer == "보"):
  40.             print ("너가 이겼다.");
  41.  
  42.     #restart
  43.     userInput = input("게임끝낼래 ? Yes or No: ")
  44.     userInput = userInput.lower()
  45.     if (userInput == "yes"):
  46.         play = False
  47.         print ("다음에 또만나요")
  48.     else:
  49.         play = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement