Advertisement
Guest User

Untitled

a guest
Jun 19th, 2022
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. from ast import While
  2. import random
  3.  
  4. jugador = input("Com et dius?: ")
  5. guanyar = int(input("Quants punts per guanyar?: "))
  6.  
  7. llista = ["pedra", "paper", "tisores"]
  8.  
  9. vspunts = 0
  10.  
  11. jopunts = 0
  12.  
  13. while vspunts != guanyar and jopunts != guanyar:
  14. jo = random.choice(llista)
  15.  
  16. vs = input("pedra, paper, tisores: ")
  17.  
  18. if vs not in llista:
  19.  
  20. print("Aquesta opció no és correcte.")
  21.  
  22. else:
  23.  
  24. print("Jo:", jo)
  25.  
  26. if vs == "pedra" and jo == "tisores":
  27. vspunts = vspunts + 1
  28. print("Anem", jopunts, "-", vspunts)
  29. if vs == "pedra" and jo == "paper":
  30. jopunts = jopunts + 1
  31. print("Anem", jopunts, "-", vspunts)
  32. if vs == "pedra" and jo == "pedra":
  33. print("Empat,", "anem", jopunts, "-", vspunts)
  34.  
  35. if vs == "tisores" and jo == "pedra":
  36. vspunts = vspunts + 1
  37. print("Anem", jopunts, "-", vspunts)
  38. if vs == "tisores" and jo == "paper":
  39. jopunts = jopunts + 1
  40. print("Anem", jopunts, "-", vspunts)
  41. if vs == "tisores" and jo == "tisores":
  42. print("Empat,", "anem", jopunts, "-", vspunts)
  43.  
  44. if vs == "paper" and jo == "pedra":
  45. vspunts = vspunts + 1
  46. print("Anem", jopunts, "-", vspunts)
  47. if vs == "paper" and jo == "tisores":
  48. jopunts = jopunts + 1
  49. print("Anem", jopunts, "-", vspunts)
  50. if vs == "paper" and jo == "paper":
  51. print("Empat,", "anem", jopunts, "-", vspunts)
  52.  
  53. if vspunts == guanyar:
  54. print("Tu guanyes")
  55.  
  56. elif jopunts == guanyar:
  57. print("Jo guanyo")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement