Question: Using the three descriptions provided below, create a small snippet of code which will: 1. ask a user to choose between rock , paper or
Using the three descriptions provided below, create a small snippet of code which will:
1. ask a user to choose between rock , paper or scissors 2.
Check to see if the player's input is either rock, paper or scissor. If it is, execute the next step if it isn't , let the player know their choice was not rock paper or scissor
3. Display the characteristic of the user item the player chose
Rock The rock is able to break the scissors, but can be defeated by the paper Paper The paper is able to wrap the rock up, but is easily cut by the scissor Scissor The scissor is able to cut paper, but is smashed by the rock
Hints
Use a dictionary to list out the pieces and descriptions Create a tuple of the three choices. Can you figure out why a tuple and not a list? Use a conditional and check to see if the input is contained in the tuple, and if it is, Print out the fact about the choice. If it isn't print out an error message Use the correct method to ensure the user's choice is searchable in the dictionary Finally use f string to print out the statement.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
