rock paper scissors python

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

showing results for - "rock paper scissors python"
Cristina
17 May 2020
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        
Andrea
09 Jan 2019
1import random
2while True:
3
4    print("\n-------------------------")
5    print("Rock, Paper, Scissors - Shoot!")
6
7    userChoice = input("Choose your weapon [R]ock, [P]aper, or [S]cissors: ")
8
9    if not userChoice in ['r','R','p','P','s','S']:
10        print("Please choose a letter!")
11        continue
12    if userChoice != "exit":
13        print("Your choice: " + userChoice)
14        choices = ['R','P','S']
15        opChoice = random.choice(choices)
16        print("Oppenent choice: " + opChoice)
17
18        if opChoice == str.upper(userChoice):
19            print("Tie!")
20        elif opChoice == 'R' and userChoice.upper() == 'S':
21            print("Rock beats Scissor,I win!")
22            continue
23        elif opChoice == 'S' and userChoice.upper() == 'P':
24            print("Scissor beats Paper,I win!")
25            continue
26        elif opChoice == 'P' and userChoice.upper() == 'R':
27            print("Paper beats Rock, I win!")
28            continue
29        else:
30            print("You win!")
31            
32#code by fawlid
Lorenzo
19 Sep 2016
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!")
Elissa
28 Nov 2019
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
Ella
18 Oct 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 game in python guipython rock paper siccorsrock paper scissors python game code to make a rock paper scissors game in pythonhow to make a rock paper scissors game in pythonrock paper scissors python rest api pythonexercise rock paper scissors python coderock paper scissors python using classesconcise rock paper scissors pythonrock paper scissors code gamerock paper scissors simplified python coderock paper scissors pythonwrite a program that plays the rock 2c paper 2c scissors game against the computerhow to code a rock paper scissors game in pythonpython rock paper scissors gampython rock paper scissors conditionpython rock paper scissors signpython rock paper scissors game without ifrock paper scissors game python guirock paper scissors game im pythonstone paper scissors game in pythonpython rock paper scissors against computerpython project rock paper scissorsrock paper scissors python programrock paper scissors in python with 2 playersrock paper scissors python two playergcse rock paper scissors game code pytohnscissors paper stone pythonrock paper scissors game in python for beginnershow to make rock paper scissors in pythonpython rock paper scissors with scorerandom rock paper scissors pythonpractice python rock paper scissorsrock paper scissors code game pygame rock paper scissors in python rock paper and scissors tournament pythonrock paper scissors python 3python rock paper scissors functionspython rock paper scissorspaper scissors rock game pythonrock paper scissors python coderock paper scissors using numpyrock paper scissors python using functionspython best rock paper scissorsrock paper scissors code for pythonrock paper scissors in python with scorehow to know the computer bet in rock paper scissors using python pythonrock paper scissor pythonrock paper scissors python and ask if he want to playcode for rock paper scissors in pythonrock paper scissors python for beginnersrock paper scissors game description in pythonhow to do rock paper scissors on pythonpython rock paper scissors without ifrock 2c paper 2c scissors pythoncode club projects rock paper scissors python easyrock paper scissors game in python using functionsrock paper scissors game in python with points for beginnerspython 3 rock paper scissorspython rock paper scissors 2 out of 3how to make rock paper sizors in less than 10 lines of code pythonscissors paper rock pythonrock paper scissors vs computer pythonrock paper scissors classes in pythonpython rock paper scissors with classrock paper scissors game in python pdfpython for rock paper scissors rulesrock paper scissors game python projectpython rock paper scissors code1 rock paper scissors how to do in pythonrock paper scissors ai self learning pythonpaper program python3stone paper scissors against computer 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 function pythonrock 2c paper scissors game in python pdfrock 2c paper 2c scissors python 2 linesrock paper scissors python abouypython rock paper scissors picturerock paper scissors loop pythonhow to do rock paper scissors in pythonpython code rock paper scissorswhat do you need to know to code a python rock paper scissors gamerock paper sciessors in pythonhow to make stone paper scissors game in pythonpython rock pper scissorspaper scissors stone game in python2 player rock paper scissors python coderock paper scissors code pythonpython rps 28 29 e2 80 9crock 2c paper 2c scissors pythonrock paper sissors python simulatorrock paper scissors python with scorerock paper scissors python while looprock paper scissors 2c pythonpython rock paper scissors game beginnermake a rock paper scissors game with machine learning pythonrock paper scissors python rest apirock paper scissors python whitout ifpython projects rock paper scissorshow to make rock paper scissors in python effeiceintrock paper scissors game with pythonstone paper scissor program in pythonpython rock paper scissors gamesrock paper scissors python code 2 functionsadvanced rock paper scissors in pythonpython paper searchsimple rock paper scissors game pythonpython while loop rock paper scissorspython rock paper scissors with classesrock paper scissors while loop pythonrock 3dr scissors 3ds paper 3dp pythonpaper scissors rock pythonrock paper scissors python repl itpython rock paper scissors how to check for winwhile loop python rock paper scissorspython rock paper scissors examplesimple python rock paper scissorspython project rock paper scissors with conceptshow to create rock paper scsoors in pythonrock paper game algorithm with pythonwhile loop rock paper scissors pythonrock paper scissors python 2 players with explanation rock paper scissor game using pythonrock paper scissors python 2 playersstone paper scissors python codeproject to build a rock paper scissors game clone in pythonrock paper and scissors python tournamentpython rock paper scissors while loophow to make rock paper scissor python game make your first python game rock paper scissorsrock paper scissors with score pythonrock 2c paper 2c and scissors pythonrock paper scissors game using pythonrock paper scissors on pythonhow to code a rock paper scissors game in python simplepython rock paper scissors gamerock paper scissor game coderock 2c paper 2c scissors python pseudocodepython oop rock paper scissorshow to make a simple rock paper scissors game in pythonrock paper scissors using ppython random ibraryrock papaer scissors game pythonpython how to make rock paper scissorsrock paper scissors python randomrps in pythonrock paper scissor python coderock paper scissors python gamegames like rock paper scissors on pythonrock papers scissors game pythonrock paper scissors written in pythonhow to code rock paper scissorsrock papaer scissors python rock paper scissors list pythonrock paper scissors game in pythonrock paper scissors python source coderock papaer cisiors python codemultiplayer rock paper scissors pythonrock paper scissors python guipython library rock paper sissporrock paper scissors game using python tkinterrock paper scissors coding in pythonrock paper sciccors python codepython code for rock paper scissorsrock 2c paper 2c scissors in pythonpython rps 28 27r 27 2c 27p 27 29simple rock paper scissors python3python making 2 player rock paper scissors using listspython rock paper show to create a data structure for rock paper scissors in pythona rock papper scissors python gamesimple python rock 2c paper 2c scissors game for beginnersrock paper scissors person vs person pythonrock paper scissors python less coderock scissors paper codepython rock paper scissors optimizedhow to make rock paper scissors vs computer in pythonrock scissors paper pythonhow to code rock paper scissors in pythonrock paper scissors ai pythonrock paper scissors python tkinterrock scissor paper game in pythonrock scissors paper python coderock paper scissors in python 27project rock paper scissors in pyhtonrock paper scissors python3rock paper scissors python logicbuild a rock paper scissors game clone in pythonhow to make a rock paper scissors game in python with scorepaper program pythonpython rock paper scissorsrock paper scissors algorithm pythonrock paper scissors function in pythonmake rock paper scissors pythonhow to code a rock paper scissors gamemost responsible rock paper scissors python gamerock paper scissors fire game in pythonrock paper scissors in pythonrock paper scissors game pythonrock paper scissors python looprock paper scissors animated game in pythonrock paper scissors python