Repl.it Python Ch 07 #5: Rock, Paper, Scissors Modification Programming Exercise 11 in Chapter 6 asked you to design a...

70.2K

Verified Solution

Question

Programming

Repl.it

Python

Ch 07 #5: Rock, Paper, ScissorsModification

Programming Exercise 11 in Chapter 6 asked you to designa program that plays the Rock, Paper, Scissors game. In theprogram, the user enters one of the three strings - “rock”,“paper”, or “scissors” - at the keyboard. Add input validation(with a case-insensitive comparison) to make sure the user entersone of those strings only.

I demonstrated the implementation of the program here:https://repl.it/@profeldridge/week06assignment06part2of2#main.py

Using the repl.it link above, modify the program toimplement a new function called “get_user_input_validated()” thatperforms input validation (with a case-insensitive comparison) tomake sure the user enters one of those strings only.

Requirements

You must use the given function prototypes. You can addmore functions if you like.

def get_user_input_validated()

Resources

  • Use the same logic and text that you used for theflowchart

  • The Python Survival Guide shows how to make a stringlowercase:https://lrccd.instructure.com/courses/102062/discussion_topics/1168996

Example Runs:

Please enter your choice(rock/paper/scissors):

rocks

Sorry - that selection is not valid. Please enter thetext 'rock', 'paper', or 'scissors'

peppers

Sorry - that selection is not valid. Please enter thetext 'rock', 'paper', or 'scissors'

ROCK

Human: [ rock ] vs. Computer: [ paper ]

Sorry! You lost

Deliverables

  1. Source Code File: Name your file main.py and submit toCanvas.

Be sure to follow a Python Style Guide:

  • Recommended (v2.0)https://lrccd.instructure.com/courses/102062/modules/items/5357574

Original (v1.0)https://lrccd.instructure.com/courses/102062/pages/python-code-style-guide?module_item_id=5176726

Answer & Explanation Solved by verified expert
4.3 Ratings (514 Votes)
Program Name Rock Paper Scissors GameFilename mainpyAuthor Professor EldridgeDate 20200921Assignment Lecture DemoDescription Book Programming Exercise 11Sources Seehttpslrccdinstructurecomcourses102062pagespythoncodestyleguidefrom random import ROCKINT 1PAPERINT 2SCISSORSINT 3ROCKSTR rockPAPERSTR paperSCISSORSSTR scissorsdef getuserinputvalidatedchoicerockpaperscissorswhile Trueuserchoice inputPlease enter your choicerockpaperscissorsif    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students