vendredi 10 mai 2019

Rock, Paper, Scissors: Unsure of how to randomize a choice then add an if-then statement

I'm pretty new to Python and an working on this homework assignment. I'm not sure how to assign the random.choice to a variable so I can proceed with a if-then statement.

import random

def whoWin(): if userInput == choices

def main():

userInput = input("rock, paper, or scissor?") print "You chose: " + userInput

choices = ["rock", "paper", "scissors"]

print "The computer chose: " + (random.choice(choices))

main()

Aucun commentaire:

Enregistrer un commentaire