Write a python program for two players to play a rock-paper

Assignment Help Python Programming
Reference no: EM132356720

Question

Rock-paper-scissors is a game played between two people, in which each player chooses rock, paper or scissors. The player who chooses rock will beat another player who has chosen scissors ("rock crushes scissors") but will lose to one who has chosen paper ("paper covers rock").

A play of paper will lose to a play of scissors ("scissors cut paper"). If both players make the same choice, the game is tied.

Write a Python program for two players to play a rock-paper-scissors game. The program first asks player 1 to enter 'r' for rock, 'p' for paper or 's' for scissors.

Use an input validation loop to check player 1's choice immediately. If player 1 has entered an invalid choice (i.e., choice that is not 'r', 'p' nor 's'), ask player 1 to re-enter his choice repeatedly until the choice entered is valid. Do the same for player 2. Then compare the chices entered by the two players and display the result of the game ("Player 1 wins", "Player 2 wins" or "Tie").

Reference no: EM132356720

Questions Cloud

Write a program which asks the user to enter their age : Write a program which asks the user to enter their age and outputs if they are an infant, a child, a teenager or an adult. Use the following rules.
Describe some of the system-procedures and processes : Ethical crises can occur in virtually any organization. Describe some of the system, procedures, and processes that can help to prevent such crises.
Role that the essential air service plays at a small public : Discuss the role that the Essential Air Service plays at a small public airport. What are the potential benefits, and which of these are the most important?
Kouzes and posner leadership practices-senge five discipline : This forum is designed to engage us in a discussion involving a comparison between Kouzes and Posner's Leadership Practices and Senge's Five disciplines
Write a python program for two players to play a rock-paper : Write a Python program for two players to play a rock-paper-scissors game.The program first asks player 1 to enter r for rock, p for paper or s for scissors.
Find and display the highest score : Create a list to store their scores. Use a loop to read their scores from the keyboard and store the scores in the list. Find and display the highest score.
Prompt the user to input five pairs of numbers : This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team.
Write a python program which asks the user for two numbers : Write a python program which asks the user for two numbers and calculates the first number raised to the second number.
Write program that uses a function that returns a count : Write program that uses a function that returns a count of all letter es whether it's upper or lower case in a sentence.

Reviews

Write a Review

Python Programming Questions & Answers

  Write new python program that contains a main function

Start with a comment that includes your name and course number. Include pseudocode that describes all steps required to solve the problem.

  Write a function to convert celsius to fahrenheit

Write a 2-part program as follows: Write a function to convert Celsius to Fahrenheit. Write a function to convert Fahrenheit to Celsius.

  Topic of effective and ethical communication

Design an algorithm and use it to write a Python program that reads the contents of the data file into a list. The program should then loop, to allow a user to check various numbers against those stored in the list.

  Write program that creates an object of productionwork class

Write a program that creates an object of the ProductionWorker class and prompts the user to enter data for each of the object's data attributes.

  Create a python program that meets the requirements outlined

Create a Python program that meets the requirements outlined. Create an automobile class that will be used by a dealership as a vehicle inventory program.

  Creating an application that simulates a banking interface

ITECH1400 - Foundations of Programming Assignment - FedUni Banking. Creating an application that uses a GUI that simulates a simple banking interface

  Define function that convert number value to character digit

COP 1500 Intro Computer Science Number Systems Project Assignment - Then define a function that can convert a number value to a character digit

  Write a program that asks the user for a number in the range

Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of the week.

  Write a program to that displays a table

Write a program to that displays a table of the Celsius temperatures 0 through 20 and their Fahrenheit and Kelvin equivalents

  Define a python function that takes two lists as arguments

Define a Python function that takes two lists as arguments. The function must return a list containing the elements that list1 and list2 have in common.

  Ask the user for the number of years in their study

Ask the user for the number of years in their study - use a small number to test, like 2, because you have to collect 12 months of data for each year!

  Write a python program that prompts the user for two inputs

Write a Python program that prompts the user for two inputs, first name and last name. The program should then generate two outputs.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd