Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MicrosoftDocs/mslearn-challenge-project-create-mini-game-with-copilot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: JCS360/python-app-dev-codespaces
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 4 commits
  • 3 files changed
  • 1 contributor

Commits on Feb 26, 2024

  1. Copy the full SHA
    199a336 View commit details
  2. Codespace rebuild container

    JCS360 committed Feb 26, 2024
    Copy the full SHA
    d5beea3 View commit details
  3. updated committed

    JCS360 committed Feb 26, 2024
    Copy the full SHA
    1ba1b27 View commit details

Commits on Feb 7, 2025

  1. Created using Colab

    JCS360 committed Feb 7, 2025
    Copy the full SHA
    4632dc0 View commit details
Showing with 778 additions and 1 deletion.
  1. +2 −1 .devcontainer/devcontainer.json
  2. +110 −0 app.py
  3. +666 −0 notebooks/model-predictions.ipynb
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -16,7 +16,8 @@
"extensions": [
"streetsidesoftware.code-spell-checker",
"ms-python.python",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"GitHub.copilot"
]
}
},
110 changes: 110 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# write 'hello world' to the console
print("Hello World")
# run the file using the command 'python app.py' in the terminal

# import random module
import random

#create a list of options that has rock, paper, and scissors
options = ["rock", "paper", "scissors"]

# create a score variable and set it to 0
score = 0

# creata a variable to count the number of rounds
rounds = 0

# create a while loop that runs as long as the rounds are less than 3
while rounds < 3:
# add 1 to the rounds variable
rounds += 1
# create a variable that stores the user's input
user_input = input("Enter rock, paper, or scissors: ")
# create a variable that stores the computer's choice
computer_choice = random.choice(options)
# print the computer's choice
print("Computer chose: ", computer_choice)
# create a conditional statement that checks if the user's input is equal to the computer's choice
if user_input == computer_choice:
# if the user's input is equal to the computer's choice, print "It's a tie!"
print("It's a tie!")
# create a conditional statement that checks if the user's input is "rock" and the computer's choice is "scissors"
elif user_input == "rock" and computer_choice == "scissors":
# if the user's input is "rock" and the computer's choice is "scissors", print "You win!"
print("You win!")
# add 1 to the score variable
score += 1
# create a conditional statement that checks if the user's input is "paper" and the computer's choice is "rock"
elif user_input == "paper" and computer_choice == "rock":
# if the user's input is "paper" and the computer's choice is "rock", print "You win!"
print("You win!")
# add 1 to the score variable
score += 1
# create a conditional statement that checks if the user's input is "scissors" and the computer's choice is "paper"
elif user_input == "scissors" and computer_choice == "paper":
# if the user's input is "scissors" and the computer's choice is "paper", print "You win!"
print("You win!")
# add 1 to the score variable
score += 1
# create a conditional statement that checks if the user's input is "rock" and the computer's choice is "paper"
elif user_input == "rock" and computer_choice == "paper":
# if the user's input is "rock" and the computer's choice is "paper", print "You lose!"
print("You lose!")
# create a conditional statement that checks if the user's input is "paper" and the computer's choice is "scissors"
elif user_input == "paper" and computer_choice == "scissors":
# if the user's input is "paper" and the computer's choice is "scissors", print "You lose!"
print("You lose!")
# create a conditional statement that checks if the user's input is "scissors" and the computer's choice is "rock"
elif user_input == "scissors" and computer_choice == "rock":
# if the user's input is "scissors" and the computer's choice is "rock", print "You lose!"
print("You lose!")
# if the user enters an invalid input, print "Invalid input!"
else:
print("Invalid input!")
# print the user's score
print("Your score: ", score)
# print the number of rounds
print("Rounds: ", rounds)
# create a conditional statement that checks if the score is greater than 1
if score > 1:
# if the score is greater than 1, print "You win the game!"
print("You win the game!")
# create a conditional statement that checks if the score is less than 1
elif score < 1:
# if the score is less than 1, print "You lose the game!"
print("You lose the game!")
# create a conditional statement that checks if the score is equal to 1
elif score == 1:
# if the score is equal to 1, print "It's a tie!"
print("It's a tie!")
# print "Game over!"
print("Game over!")
# run the file using the command 'python app.py' in the terminal
# enter rock, paper, or scissors when prompted
# the computer will randomly choose rock, paper, or scissors
# the game will run for 3 rounds
# the user's score will be printed after each round
# the result of the game will be printed at the end
# the game will be over after 3 rounds
# the user will be prompted to play again
# the user can run the file again to play another game
# the game will continue to run as long as the user wants to play
# the user can exit the game by pressing 'ctrl + c' in the terminal
# the user can exit the game by closing the terminal
# the user can exit the game by closing the file
# the user can exit the game by pressing 'q' in the terminal
# the user can exit the game by pressing 'quit' in the terminal
# the user can exit the game by pressing 'exit' in the terminal
# the user can exit the game by pressing 'e' in the terminal
# the user can exit the game by pressing 'x' in the terminal
# the user can exit the game by pressing 'end' in the terminal
# the user can exit the game by pressing 'esc' in the terminal
# the user can exit the game by pressing 'ctrl + z' in the terminal
# the user can exit the game by pressing 'ctrl + c' in the terminal
# the user can exit the game by pressing 'ctrl + x' in the terminal
# the user can exit the game by pressing 'ctrl + e' in the terminal
# the user can exit the game by pressing 'ctrl + end' in the terminal
# the user can exit the game by pressing 'ctrl + esc' in the terminal
# the user can exit the game by pressing 'ctrl + z' in the terminal


Loading