#california high school


Rock Paper Scissors Game

This program will have a user play against a computer in a game of rock paper scissors.


rock = 0 paper = 1 scissors = 2 computerwin = 0 userwin = 0 tie = 0 choices = ["rock", "paper", "scissors"] print("Hi welcome to Royce's rock paper scissors game") for x in range (1,6,1): user = str(input("Rock, paper, or scissors?")) import random rand = random.randint(0,2) compchoice = choices[rand] if compchoice == choices[1]: if user == choices[rock]: print("The computer picked paper You lose sorry") computerwin = computerwin + 1 if user == choices[scissors]: print("You win the computer picked paper!") userwin = userwin + 1 if user == choices[paper]: print("oops you both picked paper go again!") tie = tie + 1 if compchoice == choices[2]: if user == choices[rock]: print("You win the computer picked scissors!") userwin = userwin + 1 if user == choices[paper]: print("The computer picked scissors you lose!") computerwin = computerwin + 1 if user == choices[scissors]: print("oops you both picked scissors go again!") tie = tie + 1 if compchoice == choices[0]: if user == choices[paper]: print("You win the computer picked rock") userwin = userwin + 1 if user == choices[scissors]: print("The computer picked rock you lose sorry") computerwin = computerwin + 1 if user == choices[rock]: print("oops you both picked rock go again!") tie = tie + 1 print("you picked " + user) print("the computer picked " + compchoice) print("you won " + str(userwin) + " games") print("the computer won " + str(computerwin) + " games") print("you both tied " + str(tie) + " games") print("thanks for playing")

Guessing Game Python

I have made a guessing game in Python. The program starts off by generating a number. Then the player is supposed to keep guessing numbers until they have correctly guessed the unknown number. The program tells you if the player's guess is higher or lower. Once the player wins the game, they have a choice between either continue or stop playing. If they end the game, the program displays the amount of games played and guesses they attempted.


again = "yes" count = 0 games = 0 while again == "yes": import random x = random.randint(1,100) print(x) guess = int(input("Enter a number")) while guess != x: if guess < x: print("your guess was too low") if guess > x: print("your guess was too high") guess = int(input("try again:")) count = count + 1 print("correct") games = games + 1 print ("you took " + str(count) + " guesses") again = input("Do you wanna play again?") print ("you played " + str(games) + " games") print("you made " + str(count) + " guesses")
1