Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ast import While
- import random
- jugador = input("Com et dius?: ")
- guanyar = int(input("Quants punts per guanyar?: "))
- llista = ["pedra", "paper", "tisores"]
- vspunts = 0
- jopunts = 0
- while vspunts != guanyar and jopunts != guanyar:
- jo = random.choice(llista)
- vs = input("pedra, paper, tisores: ")
- if vs not in llista:
- print("Aquesta opció no és correcte.")
- else:
- print("Jo:", jo)
- if vs == "pedra" and jo == "tisores":
- vspunts = vspunts + 1
- print("Anem", jopunts, "-", vspunts)
- if vs == "pedra" and jo == "paper":
- jopunts = jopunts + 1
- print("Anem", jopunts, "-", vspunts)
- if vs == "pedra" and jo == "pedra":
- print("Empat,", "anem", jopunts, "-", vspunts)
- if vs == "tisores" and jo == "pedra":
- vspunts = vspunts + 1
- print("Anem", jopunts, "-", vspunts)
- if vs == "tisores" and jo == "paper":
- jopunts = jopunts + 1
- print("Anem", jopunts, "-", vspunts)
- if vs == "tisores" and jo == "tisores":
- print("Empat,", "anem", jopunts, "-", vspunts)
- if vs == "paper" and jo == "pedra":
- vspunts = vspunts + 1
- print("Anem", jopunts, "-", vspunts)
- if vs == "paper" and jo == "tisores":
- jopunts = jopunts + 1
- print("Anem", jopunts, "-", vspunts)
- if vs == "paper" and jo == "paper":
- print("Empat,", "anem", jopunts, "-", vspunts)
- if vspunts == guanyar:
- print("Tu guanyes")
- elif jopunts == guanyar:
- print("Jo guanyo")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement