Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: To play the rock-paper-scissors game. This program should play the rock-paper-scissors game, which is where the player picks either rock, paper, or scissors, the

Objective: To play the rock-paper-scissors game.
This program should play the rock-paper-scissors game, which is where the player picks either rock, paper, or scissors, the computer does the same, and then one of the following happen:
Rock breaks scissors
Paper covers rock
Scissors cut paper
There is a tie (both players picked the same thing)
If the user enters invalid input, your program should say so, otherwise it will output one of the above results. You should randomly generate a number to determine the computer's move.
Here is some sample output:
[cpersiko@fog cs110a]$ python3 rps.py.txt
Please enter your move: Paper, Rock, or Scissors: Paper
Computer's move is Paper
Tie with Paper!
[cpersiko@fog cs110a]$ python3 rps.py.txt
Please enter your move: Paper, Rock, or Scissors: paper
Computer's move is Scissors
Computer Wins! Scissors cut Paper!!
[cpersiko@fog cs110a]$ python3 rps.py.txt
Please enter your move: Paper, Rock, or Scissors: scissors
Computer's move is Scissors
Tie with Scissors!
[cpersiko@fog cs110a]$ python3 rps.py.txt
Please enter your move: Paper, Rock, or Scissors: Scissor
Computer's move is Paper
You Win! Scissors Cut Paper!!
[cpersiko@fog cs110a]$ python3 rps.py.txt
Please enter your move: Paper, Rock, or Scissors: rock
Computer's move is Paper
Computer Wins! Paper Covers Rock!!
[cpersiko@fog cs110a]$ python3 rps.py.txt
Please enter your move: Paper, Rock, or Scissors: r
Computer's move is Scissors
Invalid move!!
[cpersiko@fog cs110a]$
Here are the rules:
Your program should accept input of upper-case and/or lower-case letters. You can use the string's .lower() function to convert it to lower case, for example:
if user_move.lower() == 'rock':
Your program should accept "scissor" or "scissors" (with or without the s, upper or lower case) as meaning the same thing.
Your program should have at least 2 functions, including a main() function (no global variables or global code other than a call to main within an if-statement)
You should use at least one multi-way if-statement (using "elif").
You should use at least one logical "and" or "or" in your program
You should always output who won (unless there's a tie).
The output should show a variety of test cases such as above.
Every function (except main) needs to have a comment in a triple-quoted string at the beginning, briefly explaining what it does.
image text in transcribed
Objective: To play the rock-paper-scissors game This program should play the rock-paper-scissors game, which is where the player picks either rock, paper, or scissors, the computer does the same, and then one of the following happen . Rock breaks scissors Paper covers rock . Scissors cut paper * There is a tie (both players picked the same thing) If the user enters invalid input, your program should say so, otherwise it will output one of the above results. You should randomly generate a number to determine the computers move. Here is some sample output: [cpers iko@ fog cs 110a]$ python 3 rps.py.txt Please enter your move Paper, Rock, or Scissors: Paper Computer's move is Paper Tie with Paper epersikolfog cs110a1$ python3 rps.py.txt Please enter your move: Paper, Rock, or Scissorsi paper Computer's move is Scissors Computer Winsl Scissors cut Paper!! [cpersiko@fog cs 110a)s python 3 rps.py.txt Please enter your move: Paper, Rock, or Scissors: scissors Computer's move is Scissors Tie with Seissors! cpersikolfog cs110a1s python3 rps.py.txt Please enter your move: Paper, Rock, or Scissors: Selssor Computer's move is Paper You Winl Scissors Cut Paper!! [cpersikotfog cs110a]$ python3 rps.py.txt Please enter your move: Paper, Rock, or Scissors: rock Computer's move is Paper Computer Winst Paper Covers Rock! cpersikoefog ca110a1s python3 rps.py.txt Please enter your move: Paper, Rock, or Scissors: r Computer's move is Scissors Invalid move!l cpersikolfog cs110a] Here are the rules: Your program should accept input of upper-case and/or lower-case letters. You can use the string's lower function to convert it to lower case, for example: if user move. lower() .. , rock' Your program should accept "scissor" or "scissors" (with or without the s, upper or lower case) as meaning the same thing. Your program should have at least 2 functions, including a main) function (no global variables or global code other than a call to main within an if-statement) You should use at least one multi-way if-statement (using "elif"). * You should use at least one logical "and" or "or" in your program e You should always output who won (unless there's a tie). * The output should show a variety of test cases such as above. Every function (except main) needs to have a comment in a triple-quoted string at the beginning, briefly explaining what it does. Objective: To play the rock-paper-scissors game This program should play the rock-paper-scissors game, which is where the player picks either rock, paper, or scissors, the computer does the same, and then one of the following happen . Rock breaks scissors Paper covers rock . Scissors cut paper * There is a tie (both players picked the same thing) If the user enters invalid input, your program should say so, otherwise it will output one of the above results. You should randomly generate a number to determine the computers move. Here is some sample output: [cpers iko@ fog cs 110a]$ python 3 rps.py.txt Please enter your move Paper, Rock, or Scissors: Paper Computer's move is Paper Tie with Paper epersikolfog cs110a1$ python3 rps.py.txt Please enter your move: Paper, Rock, or Scissorsi paper Computer's move is Scissors Computer Winsl Scissors cut Paper!! [cpersiko@fog cs 110a)s python 3 rps.py.txt Please enter your move: Paper, Rock, or Scissors: scissors Computer's move is Scissors Tie with Seissors! cpersikolfog cs110a1s python3 rps.py.txt Please enter your move: Paper, Rock, or Scissors: Selssor Computer's move is Paper You Winl Scissors Cut Paper!! [cpersikotfog cs110a]$ python3 rps.py.txt Please enter your move: Paper, Rock, or Scissors: rock Computer's move is Paper Computer Winst Paper Covers Rock! cpersikoefog ca110a1s python3 rps.py.txt Please enter your move: Paper, Rock, or Scissors: r Computer's move is Scissors Invalid move!l cpersikolfog cs110a] Here are the rules: Your program should accept input of upper-case and/or lower-case letters. You can use the string's lower function to convert it to lower case, for example: if user move. lower() .. , rock' Your program should accept "scissor" or "scissors" (with or without the s, upper or lower case) as meaning the same thing. Your program should have at least 2 functions, including a main) function (no global variables or global code other than a call to main within an if-statement) You should use at least one multi-way if-statement (using "elif"). * You should use at least one logical "and" or "or" in your program e You should always output who won (unless there's a tie). * The output should show a variety of test cases such as above. Every function (except main) needs to have a comment in a triple-quoted string at the beginning, briefly explaining what it does

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics Of A Networked World Semantics For Grid Databases First International Ifip Conference Icsnw 2004 Paris France June 2004 Revised Selected Papers Lncs 3226

Authors: Mokrane Bouzeghoub ,Carole Goble ,Vipul Kashyap ,Stefano Spaccapietra

2004 Edition

3540236090, 978-3540236092

More Books

Students also viewed these Databases questions