1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
VladimirAG [237]
3 years ago
13

Write a Python program stored in a file q1.py to play Rock-Paper-Scissors. In this game, two players count aloud to three, swing

ing their hand in a fist each time. When both players say three, the players throw one of three gestures: Rock beats scissors Scissors beats paper Paper beats rock Your task is to have a user play Rock-Paper-Scissors against a computer opponent that randomly picks a throw. You will ask the user how many points are required to win the game. The Rock-Paper-Scissors game is composed of rounds, where the winner of a round scores a single point. The user and computer play the game until the desired number of points to win the game is reached. Note: Within a round, if there is a tie (i.e., the user picks the same throw as the computer), prompt the user to throw again and generate a new throw for the computer. The computer and user continue throwing until there is a winner for the round.
Computers and Technology
1 answer:
never [62]3 years ago
8 0

Answer:

The program is as follows:

import random

print("Rock\nPaper\nScissors")

points = int(input("Points to win the game: "))

player_point = 0; computer_point = 0

while player_point != points and computer_point != points:

   computer = random.choice(['Rock', 'Paper', 'Scissors'])

   player = input('Choose: ')

   if player == computer:

       print('A tie - Both players chose '+player)

   elif (player.lower() == "Rock".lower() and computer.lower() == "Scissors".lower()) or (player.lower() == "Paper".lower() and computer.lower() == "Rock".lower()) or (player == "Scissors" and computer.lower() == "Paper".lower()):

       print('Player won! '+player +' beats '+computer)

       player_point+=1

   else:

       print('Computer won! '+computer+' beats '+player)

       computer_point+=1

print("Player:",player_point)

print("Computer:",computer_point)

Explanation:

This imports the random module

import random

This prints the three possible selections

print("Rock\nPaper\nScissors")

This gets input for the number of points to win

points = int(input("Points to win the game: "))

This initializes the player and the computer point to 0

player_point = 0; computer_point = 0

The following loop is repeated until the player or the computer gets to the winning point

while player_point != points and computer_point != points:

The computer makes selection

   computer = random.choice(['Rock', 'Paper', 'Scissors'])

The player enters his selection

   player = input('Choose: ')

If both selections are the same, then there is a tie

<em>    if player == computer: </em>

<em>        print('A tie - Both players chose '+player) </em>

If otherwise, further comparison is made

<em>    elif (player.lower() == "Rock".lower() and computer.lower() == "Scissors".lower()) or (player.lower() == "Paper".lower() and computer.lower() == "Rock".lower()) or (player == "Scissors" and computer.lower() == "Paper".lower()): </em>

If the player wins, then the player's point is incremented by 1

<em>        print('Player won! '+player +' beats '+computer) </em>

<em>        player_point+=1 </em>

If the computer wins, then the computer's point is incremented by 1

<em>    else: </em>

<em>        print('Computer won! '+computer+' beats '+player) </em>

<em>        computer_point+=1 </em>

At the end of the game, the player's and the computer's points are printed

<em>print("Player:",player_point) </em>

<em>print("Computer:",computer_point)</em>

You might be interested in
Ladders are a fundamental piece of equipment on construction sites and employers are expected to ensure that workers follow safe
Ede4ka [16]
That statement is true.

Ladders commonly used to do a couple of construction activities in a higher region of a building or area.
If this equipment is not used properly, it could potentially caused  fatal accidents for the people on the site
6 0
3 years ago
Describe the pace of change in ICT
densk [106]

Answer:

Information and communications technology is an extensional term for information technology that stresses the role of unified communications and the integration of telecommunications and computers, as Technology Trends 2016

#1: Spreading intelligence throughout the cloud. ...

#2: Self-managing devices. ...

#3: Communication beyond sight and sound. ...

#4: Fundamental technologies reshaping what networks can do. ...

#5: Weaving security and privacy into the IoT fabric.

Explanation:

look for a question that i have answered answer it and also plz give me brainliest on this one plz

4 0
3 years ago
HELP ME PLEASE !!!!!
aalyn [17]

Answer:

C

Explanation:

6 0
3 years ago
Which Call of Duty game is the best?
love history [14]

Answer:

i like ghost and modern 3

Explanation:

3 0
3 years ago
What are two great ways to find clues to locate commands on the ribbon?
Lapatulllka [165]

Solution:

Look at the tabs and hover over images. are two great ways to find clues to locate commands on the ribbon.

There are six main categories for command which are; one-click, toggle, split buttons, drop-down and tick box.  Categories can be mixed so it is useful to understand the basics to develop the Excel skills.

The ribbon is a user interface element created by Microsoft, which was introduced with Microsoft Office 2007. It is part of the "Microsoft Office Fluent" interface and combines the menu bar and toolbar into a single floating pane. By default, it is located at the top of the screen in Office applications, such as Access, Excel, PowerPoint, Word, and Outlook.

This is the required solution.


6 0
3 years ago
Other questions:
  • ________ is typically used as the last string of letters in the name of a website. Group of answer choices the name of the indiv
    13·1 answer
  • A computer is defined by 4 specific criteri. Select all 4.*
    7·1 answer
  • Program Rock.java contains a skeleton for the game Rock, Paper, Scissors. Open it and save it to your directory. Add statements
    10·1 answer
  • Technician A says that to cover all possible vehicle conditions, coolant must have a high freezing point. Technician B says cool
    6·2 answers
  • Instructions:Select the correct answer from each drop-down menu. What type of font color should Kim select if she chooses a dark
    10·2 answers
  • When two or more tables share the same number of columns, and when their corresponding columns share the same or compatible doma
    12·1 answer
  • Check My Work Sherri is considering replacing a processor on her laptop. The laptop is running slower than she would like. What
    9·1 answer
  • There are parallels between the trust models in Kerberos and Public Key Infrastructure (PKI). When we compare them side by side,
    15·1 answer
  • The system where the unit of measurement is centimeter
    15·1 answer
  • Consider the following statements regarding computers:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!