๐Ÿ PyQuestโœ‚๏ธ Game: Rock Paper Scissors ยท ๐Ÿค– Step 1: The Computer Throws First
โญ 0 XP๐Ÿ Python is waking upโ€ฆ

Step 1: The Computer Throws First ๐Ÿค–

Time to build Rock Paper Scissors against a computer opponent. โœŠโœ‹โœŒ๏ธ

For it to be a fair fight, the computer needs a move you can't predict. You could use randint, but here you're picking from words, not numbers โ€” and that's exactly what random.choice() does:

import random

snacks = ["chips", "apple", "cookie"]
pick = random.choice(snacks)
print(pick)

random.choice() reaches into a list and grabs one item at random. Give it a list of moves and you've got an opponent.

Your mission

  1. import random at the top
  2. Make a list called moves holding "rock", "paper" and "scissors"
  3. Use random.choice(moves) to fill a variable called computer
  4. Print what the computer threw, then run it a few times to see it change!

Your code

Press โ–ถ Run to see what your code does!