Text Size
Text Size
Exit Full Screen
Python Mini
Show
Source Code
View Source Code in Full Screen
Open in New Tab
import random import time gameInProgress = True while gameInProgress: moves = ["rock", "paper", "scissors"] yourMove = raw_input("Make your move! Choose 'Rock', 'Paper', or 'Scissors'!") yourMove = yourMove.lower() compMove = random.choice(moves) time.sleep(1) print "Rock, paper, scissors and shoot!" time.sleep(1) print "Your move: %s!" % (yourMove) print "Your opponent's move: %s!" % (compMove) time.sleep(2) if yourMove == compMove: print "Awww, stalemate!!!" break elif yourMove == "rock" and compMove == "paper": print "Your rock got eaten by opponent's paper!" time.sleep(1) print "You got Defeated!" break elif yourMove == "rock" and compMove == "scissors": print "Your rock shattered opponent's scissors!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "paper" and compMove == "rock": print "Your paper ate opponent's rock!" time.sleep(1) print "You achieved Victory!!!" break elif yourMove == "paper" and compMove == "scissors": print "Your paper got slashed to bits by opponent's scissors!" time.sleep(1) print "You got Defeated!" break elif yourMove == "scissors" and compMove == "rock": print "Your scissors got shattered by opponent's rock!" time.sleep(1) print "You got Defeated!" break elif yourMove == "scissors" and compMove == "paper": print "Your scissors shredded opponent's paper to bits!" time.sleep(1) print "You achieved Victory!!!" break else: print "Invalid move! It must be either Rock, Paper or Scissors!" time.sleep(1) print "Try again!!!" print "" time.sleep(2) continue
ch_RokPapelTijeras.py
( around 54 lines python code )
Published By:
EM5700
Published on
2019-09-27T23:36:53Z
Python Mini
- an
OYOclass
application,
own your own class today
.
Run
Result
×
Error message shows here