1

PIEDRA, PAPEL O TIJERAS AL MEJOR DE 3

#juego de piedra, papel o tijera
import random

print("Juego de piedra, papel o tijeras\n")
print("El ganador sera al mejor de 3\n")
option = ("piedra" , "papel" , "tijeras")
user_wins = 0
computer_wins = 0

whileTrue:

  user_option = input("Ingrese su opcion - piedra, papel o tijeras => ").lower()
  print("\n")

  if user_option notin option:
    print("Opcion invalida\n")

  computer_option = random.choice(option)

  print("Tu eleccion es => " + user_option + "\n")
  print("Computer option => " + computer_option + "\n")

  if user_option == computer_option:
    print("Empate\n")
  elif user_option == "piedra":
    if computer_option == "tijeras":
      print("Piedra gana a tijeras\n")
      print("GANASTE\n")
      user_wins += 1
    else:
      print("Papel gana a piedra")
      print("PERDISTE\n")
      computer_wins += 1
  elif user_option == "papel":
    if computer_option == "piedra":
      print("Papel gana a piedra\n")
      print("GANASTE\n")
      user_wins += 1
    else:
      print("tijera gana a papel\n")
      print("PERDISTE\n")
      computer_wins += 1
  elif user_option == "tijeras":
    if computer_option == "papel":
      print("tijeras gana a papel\n")
      print("GANASTE\n")
      user_wins += 1
    else:
      print("piedra gana a tijeras\n")
      print("PERDISTE\n")
      computer_wins += 1

  print("Puntos usuario => " + str(user_wins))
  print("Puntos computadora => " + str(computer_wins))
  print("\n")

  if user_wins == 2:
    print("El ganador eres tu")
    breakelif user_wins == 2:
    print("El ganador es la computadora")
    break
Escribe tu comentario
+ 2