lunes, 18 de septiembre de 2023

SEMANA DEL 18 AL 22 DE SEPTIEMBRE 2023

PROGRAMA DE PIEDRA PAPEL O TIJERA COMPLETO, PRACTICA FINAL DE TEMA WHILE


import random


x=1

g=0 ##Ganado

p=0  ##Perdido

e=0  ## Empate

while x<=2:


    aleatorio = random.randrange(0, 2)

    eligePc = ""

    print("1)Piedra")

    print("2)Papel")

    print("3)Tijera")

    opcion = int(input("Que eliges: "))


    if opcion == 1:

        eligeUsuario = "piedra"

    if opcion == 2:

        eligeUsuario = "papel"

    if opcion == 3:

        eligeUsuario = "tijera"

    

    print("Tu eliges: ",eligeUsuario)


    if aleatorio == 0:

        eligePc = "piedra"

    if aleatorio == 1:

        eligePc = "papel"

    if aleatorio == 2:

        eligePc = "tijera"

    print("PC eligio: ", eligePc)

    print("...")

    if eligePc == "piedra" and eligeUsuario == "papel":

        print("Ganaste, papel envuelve piedra")

        g=g+1

    if eligePc == "papel" and eligeUsuario == "tijera":

        print("Ganaste, Tijera corta papel")

        g=g+1

    if eligePc == "tijera" and eligeUsuario == "piedra":

        print("Ganaste, Piedra pisa tijera")

        g=g+1

    if eligePc == "papel" and eligeUsuario == "piedra":

        print("perdiste, papel envuelve piedra")

        p=p+1

    if eligePc == "tijera" and eligeUsuario == "papel":

        print("perdiste, Tijera corta papel")

        p=p+1

    if eligePc == "piedra" and eligeUsuario == "tijera":

        print("perdiste, Piedra pisa tijera")

        p=p+1

    if eligePc == eligeUsuario:

        print("empate")

        e=e+1

    print(" ")

    print(" ")

    z=int(input("Deseas otro turno  1 = SI  5 = NO  ==> "))

    if z<=1:

       x=1

       print(" ")

       print(" ")

       print(" ")

       print(" ")

       

    else:

       x=5

       

print(" ")

print(" ")

print("RESULTADO FINAL")

print(" ")

print("GANADOS => ",g)

print(" ")

print("PERDIDOS => ",p)

print(" ")

print("EMPATES => ",e)

print(" ")

if g>p:

   print ("Eres el master del juego")

if p>g:

   print ("Eres un PERDEDOR")   


intro=input("Pulsa enter para salir")


19 DE SEPTIEMBRE:






No hay comentarios.:

Publicar un comentario