Update pages/ex6: Pedra-paper-tisora.py
Browse files- pages/ex6: Pedra-paper-tisora.py +17 -20
pages/ex6: Pedra-paper-tisora.py
CHANGED
|
@@ -7,28 +7,25 @@ ordinador=""
|
|
| 7 |
j=0
|
| 8 |
o=0
|
| 9 |
|
| 10 |
-
if st.button("
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
if st.button("Tisora"):
|
| 17 |
-
jugador="Tisora"
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
break
|
| 32 |
|
| 33 |
if j>o:
|
| 34 |
st.write(f"El jugador ha guanyat")
|
|
|
|
| 7 |
j=0
|
| 8 |
o=0
|
| 9 |
|
| 10 |
+
if st.button("Paper"):
|
| 11 |
+
jugador="Paper"
|
| 12 |
+
if st.button("Pedra"):
|
| 13 |
+
jugador="Pedra"
|
| 14 |
+
if st.button("Tisora"):
|
| 15 |
+
jugador="Tisora"
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
x=["Paper","Tisora","Pedra"]
|
| 18 |
+
ordinador=choice(x)
|
| 19 |
+
st.write("Ordinador:", ordinador)
|
| 20 |
|
| 21 |
+
if jugador=="Pedra" and ordinador=="Paper" or jugador=="Paper" and ordinador=="Tisora" or jugador=="Tisora" and ordinador=="Pedra":
|
| 22 |
+
o=o+1
|
| 23 |
+
break
|
| 24 |
+
elif jugador==ordinador:
|
| 25 |
+
st.write("Empat, torna a tirar")
|
| 26 |
+
else:
|
| 27 |
+
j=j+1
|
| 28 |
+
break
|
|
|
|
| 29 |
|
| 30 |
if j>o:
|
| 31 |
st.write(f"El jugador ha guanyat")
|