Posts

Showing posts with the label Game

Rock, Paper, Scissor using Python 3

Image
  Rock, Paper, Scissor using Python  I’m guessing you’re learning Python because you want to write interactive programs, like video games. Well, today is your lucky day. You’re going to program your first Python game. Rock, Paper, Scissor  Open IDLE and create a new file, rps.py. Then enter the following:  __________________________________________________________________________________  from random import randint #create a list of play options t = [ "Rock" , "Paper" , "Scissors" ] #assign a random play to the computer computer = t [ randint ( 0 , 2 ) ] #set player to False player = False while player == False : #set player to True player = input ( "Rock, Paper, Scissors?" ) if player == computer : print ( "Tie!" ) elif player == "Rock" : if computer == "Paper" : print ( "You lose!" , computer , "covers...