python rock paper scissors

Solutions on MaxInterview for python rock paper scissors by the best coders in the world

showing results for - "python rock paper scissors"
Curtis
21 Jun 2016
1import random
2
3rock = '''
4    _______
5---'   ____)
6      (_____)
7      (_____)
8      (____)
9---.__(___)
10'''
11
12paper = '''
13    _______
14---'   ____)____
15          ______)
16          _______)
17         _______)
18---.__________)
19'''
20
21scissors = '''
22    _______
23---'   ____)____
24          ______)
25       __________)
26      (____)
27---.__(___)
28'''
29while True:
30    game_images = [rock, paper, scissors]
31
32    user_choice = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n"))
33    print(game_images[user_choice])
34
35    computer_choice = random.randint(0, 2)
36    print("Computer chose:")
37    print(game_images[computer_choice])
38
39    if user_choice >= 3 or user_choice < 0: 
40        print("You typed an invalid number, you lose!") 
41    elif user_choice == 0 and computer_choice == 2:
42        print("You win!")
43    elif (computer_choice == 0 and user_choice == 2) or (computer_choice > user_choice):
44        print("You lose")
45    elif user_choice > computer_choice:
46        print("You win!")
47    elif computer_choice == user_choice:
48        print("It's a draw")
49        
Sandro
14 Jun 2020
1import random
2while True:
3    choices = ["rock","paper","scissors"]
4
5    Computer = random.choice(choices)
6    Player = None
7
8    
9    while Player not in choices:
10       Player = input("Rock,Paper or Scissors?:").lower()
11
12    if Player == Computer:
13       print("computer:", Computer)
14       print("Player:", Player)
15       print("Draw!")
16
17    elif Player == "rock":
18        if Computer == "paper":
19            print("computer:", Computer)
20            print("Player:", Player)
21            print("YOU WIN !:D")
22        if Computer == "scissors":
23            print("computer:", Computer)
24            print("Player:", Player)
25            print("YOU LOSE:(")
26
27    elif Player == "paper":
28        if Computer == "rock":
29            print("computer:", Computer)
30            print("Player:", Player)
31            print("YOU WIN! :D")
32        if Computer == "scissors":
33            print("computer:", Computer)
34            print("Player:", Player)
35            print("YOU LOSE:(")
36
37    elif Player == "scissors":
38        if Computer == "paper":
39            print("computer:", Computer)
40            print("Player:", Player)
41            print("YOU WIN! :D")
42        if Computer == "rock":
43            print("computer:", Computer)
44            print("Player:", Player)
45            print("YOU LOSE:(")
46  
47    Play_again = input("Play again?(Yes/No):").lower()
48    
49    if Play_again != "Yes".lower():
50       break
51
52print("Bye!")
Alycia
07 Oct 2016
1import random
2
3game_list = ['Rock', 'Paper', 'Scissors']
4computer = c = 0
5command = p = 0
6
7print("Score: Computer" + str(c) + " Player " + str(p))
8
9# the loop
10run = True
11while run:
12    computer_choice = random.choice(game_list)
13    command = input("Rock, Paper, Scissors or Quit: ")
14
15    if command == computer_choice:
16        print("Tie")
17    elif command == 'Rock':
18        if computer_choice == 'Scissors':
19            print("Player won!")
20            p += 1
21        else:
22            print("Computer won!")
23            c += 1
24    elif command == 'Paper':
25        if command == 'Rock':
26            print("Player won!")
27            p += 1
28        else:
29            print("Computer won!")
30            c += 1
31    elif command == 'Scissors':
32        if computer_choice == 'Paper':
33            print("Player won!")
34            p += 1
35        else:
36            print("Computer won!")
37            c += 1
38    elif command == 'Quit':
39        break
40    else:
41        print("Wrong command! ")
42
43    print("Player: " + command)
44    print("Computer: " + computer_choice)
45    print("")
46    print("Score: Computer " + str(c) + " Player " + str(p))
47    print("")
48
Camilla
02 Jan 2018
1from random import randint
2t = ["Rock", "Paper", "Scissors"]
3computer = t[randint(0,2)]
4print("My Rock, Paper and Scissor Game!!")
5score=0
6C=0
7
8while C<5:
9
10    player = input("What's your move?  :")
11    if player == computer:
12        print("Tie!")
13        print(score)
14    elif player == "Rock":
15        if computer == "Paper":
16            print("You lose!", computer, "covers", player)
17            score=score - 1
18            print(score)
19        else:
20            print("You win!", player, "smashes", computer)
21            score = score + 1
22            print(score)
23    elif player == "Paper":
24        if computer == "Scissors":
25            print("You lose!", computer, "cut", player)
26            score = score - 1
27            print(score)
28        else:
29            print("You win!", player, "covers", computer)
30            score = score + 1
31            print(score)
32    elif player == "Scissors":
33        if computer == "Rock":
34            print("You lose...", computer, "smashes", player)
35            score = score - 1
36            print(score)
37        else:
38            print("You win!", player, "cut", computer)
39            score = score + 1
40            print(score)
41    else:
42        print("That's not a valid play. Check your spelling!")
43    C = C + 1
44
45print('Your final score is: ' +str(score))
queries leading to this page
rock paper scissors python using classesrock paper scissor python coderock paper scissors person vs person pythonrock 2c paper 2c scissors in pythonstone paper scissors game in pythonmost responsible rock paper scissors python gamepython rock paper scissors game without ifrock papaer scissors game pythonrock paper scissors python loopmake rock paper scissors pythonadvanced rock paper scissors in pythonrock paper scissors vs computer pythonrock paper scissors using ppython random ibraryrock scissors paper coderock paper scissors while loop pythonrock paper scissors ai self learning pythonpython rock paper scissors without ifpython rock paper scissors 2 out of 3rock papaer scissors python how to make stone paper scissors game in python rock paper scissor game using pythonpython rock paper siccorsrock paper scissors game in python for beginnersstone paper scissor program in pythonrock paper scissors python 2 players with explanationrock paper scissors python abouypaper scissors rock game pythonrock paper scissors game in pythonpython rock paper scissors examplehow to make rock paper sizors in less than 10 lines of code pythonscissors paper rock pythonrock paper scissors python with scorerock paper scissors python repl itrock paper scissors python codeproject to build a rock paper scissors game clone in pythonrock paper scissors in python 27rock paper scissors coding in pythonpython code for rock paper scissorsbuild a rock paper scissors game clone in pythonrock paper scissors python using functionshow to make a rock paper scissors game in python with scorescissors paper stone pythonrock paper scissors python and ask if he want to playpython rps 28 27r 27 2c 27p 27 29rock paper scissors function in pythonhow to code rock paper scissorspython rock paper spaper scissors rock pythonrock paper sciccors python coderock paper scissors game using pythonrock paper scissors game python projecthow to code a rock paper scissors game in python simplepaper program pythonrock paper scissors python tkinterstone paper scissors against computer pythonpractice python rock paper scissorspython rock paper scissors with classesrock scissor paper game in pythonpython while loop rock paper scissorsrock paper scissors using numpyrock paper scissors game with pythonrock paper scissors 2c pythonwrite a program that plays the rock 2c paper 2c scissors game against the computer e2 80 9crock 2c paper 2c scissors pythonwhile loop python rock paper scissorspython rock pper scissorspython rock paper scissors gamrock paper scissor pythonpc chance 3drock print 28 27pc choose 27 2crock 29 elif random chance 3d 3d1 3a pc chance 3dpaper print 28 27pc choose 27 2cpaper 29 elif random chance 3d 3d2 3a pc chance 3dscissors print 28 27pc choose 27 2cscissors 29rock paper scissors python less codepython rock paper scissors against computerrock paper scissors python gamerock paper scissors code for pythona rock papper scissors python gamerock 2c paper 2c scissors python pseudocodestone paper scissors python coderock paper scissors code pythonrock 2c paper 2c scissors python 2 linespython paper searchpython how to make rock paper scissorsrock paper scissors game in python with points for beginnershow to make a rock paper scissors game in pythonpython rock paper scissors how to check for wincode club projects rock paper scissors python easyrock paper scissors python programpython rock paper scissors with classhow to create rock paper scsoors in pythonrock paper scissors code gamepython best rock paper scissorsrock paper scissors in python with 2 playerspython 3 rock paper scissorspython code rock paper scissorsexercise rock paper scissors python coderps in pythonrock paper scissors game in python guipython for rock paper scissors rulespython rock paper scissorsrock paper scissors game description in pythonrock paper scissors list pythonpython rock paper scissors coderock paper sissors python simulatorrock scissors paper python codewhile loop rock paper scissors pythonpython rock paper scissors conditionrock papaer cisiors python coderock paper scissors python 2 playerspython project rock paper scissors with conceptsrock papers scissors game pythonrock paper scissors python for beginnerspython rps 28 29python projects rock paper scissorsproject rock paper scissors in pyhtonrock paper scissors loop pythonrock paper scissors algorithm pythonrock paper scissors python two playerpython rock paper scissors gamehow to make rock paper scissor python game python oop rock paper scissorsrock paper scissors in pythonpython rock paper scissorsrock paper scissors python game rock paper scissors code game pygamerock paper scissors animated game in pythonhow to make rock paper scissors vs computer in pythonrock paper scissors fire game in pythonrock paper scissors python guihow to do rock paper scissors in pythonrock paper scissors python whitout ifrock paper scissors game using python tkintersimple python rock 2c paper 2c scissors game for beginnershow to make rock paper scissors in pythonrock paper scissors game python guirock paper scissors game pythongcse rock paper scissors game code pytohnhow to code rock paper scissors in pythonrock paper sciessors in pythonrock paper game algorithm with pythoncode to make a rock paper scissors game in pythonrock paper scissors simplified python codesimple python rock paper scissorspython rock paper scissors gamespython rock paper scissors while looppython rock paper scissors game beginnerrock paper scissors function pythonpaper scissors stone game in pythonrock paper scissors game im python1 rock paper scissors how to do in pythonmake a rock paper scissors game with machine learning pythonrock paper scissors ai pythonrock paper scissors python randomrock paper scissors python source coderock paper scissor game coderock paper scissors python3simple rock paper scissors python3simple rock paper scissors game pythonrock scissors paper pythonrock paper scissors on pythonrock paper scissors written in pythonhow to code a rock paper scissors game in pythonhow to make rock paper scissors in python effeiceinthow to do rock paper scissors on pythonrock paper scissors with score pythonpython library rock paper sissporrock 3dr scissors 3ds paper 3dp pythonpaper program python3rock paper scissors game in python pdfpython project rock paper scissorsrock paper scissors game in python using functionswhat do you need to know to code a python rock paper scissors gamerock paper scissors python2 player rock paper scissors python codehow to code a rock paper scissors gamerock paper scissors in python with scorepython making 2 player rock paper scissors using listsconcise rock paper scissors pythonmake your first python game rock paper scissorspython rock paper scissors