Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a PYTHON program that let the user play the game of Rock, Paper, Scissors

ID: 3641160 • Letter: D

Question

Design a PYTHON program that let the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows:

When the program begins, a random number in the range of 1 through 3 is generate. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don’t display the computer's choice yet.)
The user enters his or her choice of “rock,” “paper,” “scissors” at the keyboard.
The computer's choice is displayed.
The program should display a message indicating whether the user or the computer's was the winner. A winner is selected according to the following rules:

If one player chooses rock and the other player chooses scissors, then rock win. ( The rock smashes the scissors.)
If one player chooses scissors and the other player chooses paper, then scissors win. ( Scissors cut paper.)
If one paler chooses paper and other player chooses rock, then paper wins. (Paper wraps rock.)
If both players make the same choice, the game must be played again to determine the winner.

Explanation / Answer

import random as a def greet(): print "Welcome to Rock,paper,scissors" def returnComp(): lis = [1,2,3] return a.choice(lis) def getUserInput(): print "what are you going to do?" print "1.rock, 2.paper. 3.scissors" return input() def convertToString(num): if num == int(1): return "Rock" elif num ==int(2): return "Paper" else: return "scissors" def goAgain(): print "do you want to go again?" return raw_input() def whoWon(p,c): if p == c: print "the game ended in a draw" elif p == 3 and c == 2: print "congrats you won" elif p == 2 and c == 1: print "congrats you won" elif p == 1 and c == 3: print "congrats you won" else: print "you loose" def playGame(): while(1): greet() p = getUserInput() c = returnComp() print "you made the choice " + convertToString(p) + " computer did " + convertToString(c) whoWon(p,c) resp = goAgain() if resp == "yes": print "yes" else: break playGame() You have to indent the code so it works, if you cant get it to work msg me your email and I will send you the code in a .py