Time to Play! More Script Exercises 🤹‍♀️¶

Random Fun¶

Open rand.py and modify the script to print the variable x so you can see what it contains. Run the program multiple times to see how x changes and see if you can guess what it represents.

Guess the Number¶

Write a program number_guesser.py that does the following:

  1. Sets a random secret number from 1-14
  2. Prompts input for a guess of what the number is
  3. Prints a success message if the guess is correct and the program ends
  4. If the number is incorrect, print a message indicating if the number is higher or lower
  5. Prints “Out of tries!” after the third incorrect guess

Rock, Paper, Scissors¶

Create a rock, paper, scissors program (rock_paper_scissors.py) that evaluates two moves given as input and prints out which move would win. You can reference the rules of rock, paper, scissors here.


Edit compliments.py so it prints out a random compliment from the variable compliments.

Snobby Greeting¶

Change greeting.py to have the following behavior:

  1. Check if the given name has a “t” or “m” in it.
  2. Print something very friendly if it does
  3. Print “Oh. Hi.” if it doesn’t
  4. Make sure you check for both upper- and lower-case letters

Magic 8 Ball¶

Make a program magic_eight_ball.py that takes a yes or no question as and gives a yes, no, or maybe response at random.

Virtual Paper Fortune Teller¶

Create a program python_fortune_teller.py that emulates the experience of a paper fortune teller. The program should:

  1. Ask for a color chosen from 4 colors
  2. Ask for a number chosen from a set of 4 numbers depending on which color was chosen
  3. Repeat step 2 as long as you’d like
  4. Finally, have the user choose from a set of 4 numbers and reveal a fortune related to that number

Interactive Rock, Paper, Scissors¶

Update your rock, paper, scissors program to play against the computer. It should work like this:

  1. Prompt the user for a move
  2. Choose a move at random for the computer
  3. Print what the computer chose and who won