subject

Rock, Paper, Scissors In this unit, you expanded your Python skills, and now you can really have some fun! In this lab, you are going to create a game that allows the user to play Rock, Paper, Scissors against the computer. If you aren’t familiar with this classic game, here’s how it works: two people (or a person and a computer!) each select either rock, paper, or scissors. The player who chooses the stronger object wins. Here is how the winner is determined:

Rock beats scissors because a rock can break scissors.
Paper beats rock because paper can cover a rock.
Scissors beats paper because scissors can cut paper.
Go to https://repl. it/ to write your program.

Your program should do the following:

Randomly choose rock, paper, or scissors for the computer
Ask the user to choose rock, paper, or scissors
Compare the computer’s choice to the player’s choice
Announce whether the computer or the human won
Here are two hints to help you write this program:

Test parts of your program to see if they work before moving on to work on other parts. For example, you will need to have the computer select a random number and then choose for that number to correspond to rock, paper, or scissors. You can write just that portion of the program and then test it by having the program print the word “rock,” “paper,” or “scissors” before you even begin working on the part of the program where the user inputs their choice. (Of course, don’t forget to erase the line of code that prints the computer’s choice when you are finished testing—otherwise the game will be just a bit too easy for the user!)
On a piece of paper, draw a chart that shows all nine possible outcomes of the game and use that chart to design and test the program. The chart might look like this:
TABLE 1 Rock paper scissors outcomes
Computer chooses rock Computer chooses paper Computer chooses scissors
User chooses rock

Tied game

Computer wins

User wins

User chooses paper

User chooses scissors

Run several tests on your program to be sure that the correct winner is announced.

When your program works properly, take a screenshot of your code to turn in.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:00, willowcollins3753
Write a program that uses a widgetviewer object to do the following: generate two random integers between 1 and 9 (inclusive). name one of them x, the other y. display them to the user using jlabel objects. create a jlabel object displaying the text "enter an operation number." create a jtextfield for the user's input. create a jbutton displaying the text "press here when you've entered your operation." use addandwait to add it to the widgetviewer object. when the user clicks the jbutton, evaluate operation in the following order to determine the one and only mathematical operation to perform on x and y. use a jlabel to display the result. if operation is between 1 and 10 inclusive, add x and y. if operation is evenly divisible by 4, subtract y from x. if operation is evenly divisible by 5, use integer division to divide y into x. if operation is an even number, use floating point division to divide y into x. if none of the other tests on operation apply, multiply x and y. note: operation can be negative or zero.
Answers: 2
image
Computers and Technology, 22.06.2019 10:20, vuqepete4528
Shown below is the start of a coding region within the fist exon of a gene. 5'--3' 3'--5' how many cas9 pam sequences are present?
Answers: 1
image
Computers and Technology, 23.06.2019 03:10, nxusasmangaliso8780
Fill in the following program so that it will correctly calculate the price of the orange juice the user is buying based on the buy one get one sale.#include //main functionint main() { int cartons; float price, total; //prompt user for input information printf("what is the cost of one container of oj in dollars? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & price); printf("how many containers are you buying? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & cartons); if ( [ select ] ["cartons / 2", "cartons % 1", "cartons % 2", "cartons % price", "cartons / price", "cartons / total"] [ select ] ["=", "==", "! =", "< =", "> =", "< "] 0) total = [ select ] ["price * cartons", "cartons * price / 2 + price", "(cartons / 2) * price", "cartons / (2.0 * price)", "(cartons / 2.0) * price + price", "((cartons / 2) * price) + price"] ; else total = ((cartons / 2) * price) + price; printf("the total cost is $%.2f.\n", total); return 0; }
Answers: 2
image
Computers and Technology, 23.06.2019 19:00, amayax77
Write a program that displays the following menu: geometry calculator 1. calculate the area of a circle 2. calculate the area of a rectangle 3. calculate the area of a triangle 4. quit enter your choice (1-4): if the user enters 1, the program should ask for the radius of the circle and then display its area. use the following formula: area = ď€(the square of r) use 3.14159 for ď€ and the radius of the circle for r. if the user enters 2, the program should ask for the length and width of the rectangle and then display the rectangle’s area. use the following formula: area = length * width if the user enters 3, the program should ask for the length of the triangle’s base and its height, and then display its area. use the following formula: area = base * height * .5 if the user enters 4, the program should end. input validation: display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu. do not accept negative values for the circle’s radius, the rectangle’s length or width, or the triangle’s base or height. note: if the user enters an improper menu choice (1-4), the program prints "the valid choices are 1 through 4. run the program again and select one of those." if the user enters a negative radius, the program prints "the radius can not be less than zero." if the user enters a negative value for height or base, the program prints "only enter positive values for base and height."
Answers: 1
You know the right answer?
Rock, Paper, Scissors In this unit, you expanded your Python skills, and now you can really have so...

Questions in other subjects: