Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pending changes exported from your codespace #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,47 @@
#-----------------------------------------------------------------------------------------

from flask import Flask
import random
app = Flask(__name__)

@app.route("/")
def hello():
return app.send_static_file("index.html")
# write 'hello world' to the console
print("hello world")

def play_game():
options = ["rock", "paper", "scissors"]
player_score = 0
opponent_score = 0

while True:
player_choice = input("Elige una opción (rock, paper, scissors): ").lower()

if player_choice not in options:
print("Opción no válida. Por favor, elige entre rock, paper o scissors.")
continue

opponent_choice = random.choice(options)
print("El oponente eligió:", opponent_choice)

if player_choice == opponent_choice:
print("Empate!")
elif (player_choice == "rock" and opponent_choice == "scissors") or \
(player_choice == "scissors" and opponent_choice == "paper") or \
(player_choice == "paper" and opponent_choice == "rock"):
print("¡Ganaste!")
player_score += 1
else:
print("Perdiste.")
opponent_score += 1

play_again = input("¿Quieres jugar de nuevo? (s/n): ").lower()
if play_again != "s":
break

print("Puntuación final:")
print("Jugador:", player_score)
print("Oponente:", opponent_score)

play_game()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi