POST 11: MADDNESS AND I WASNT HERE LAST FRIDAY AS MY COUSIN WAS SICK AND MY AUNT DIDNT WANT US SPREADING ANYTHING SO ESCUSE LAST FRIDAY

for this project I made rock paper scissors with the random function from a youtube tutorial

import random

options = (“rock”, “paper”, “scissors”)

running = True

This shows the options the program can choose from and what you can choose yourself

while running:

    player = None

    computer = random.choice(options)

This is what makes the program choose randomly from the choices and what makes it so the program doesn’t choose for you

    while player not in options:

        player = input(“Enter a choice (rock, paper, scissors): “)

This is the input for the player to put in their move

    print(f”Player: {player}”)

    print(f”Computer: {computer}”)

This is what prints both player and computers choices to determine the winner

    if player == computer:

        print(“It’s a tie!”)

    elif player == “rock” and computer == “scissors”:

        print(“You win!”)

    elif player == “paper” and computer == “rock”:

        print(“You win!”)

    elif player == “scissors” and computer == “paper”:

        print(“You win!”)

    else:

        print(“You lose!”)

This is what prints if you win or lose

    if not input(“Play again? (y/n): “).lower() == “y”:

        running = False

print(“Thanks for playing!”)

This is what happens after you win or lose you can choose to play again but you can choose not to and it thanks you for playing

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top