Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 1.17 KB

File metadata and controls

41 lines (26 loc) · 1.17 KB

Lab 3.01 - Magic 8-Ball

Practice importing random

Use randint with different arguments. Simulate a dice roll, printing out to the user what number they rolled.

Look at the documentation of the random library. Experiment with another function in the random library (not randint) that returns a value.

Create a program that simulates a Magic 8-Ball

  1. Store all of the 8-Ball's possible responses (shown below) in a list
  2. Have the program prompt the user to ask the Magic 8-Ball a question
  3. Then return and print a random response.

Magic 8-Ball Response Examples

  • Outlook is good
  • Ask again later
  • Yes
  • No
  • Most likely no
  • Most likely yes
  • Maybe
  • Outlook is not good

Video Explanation

Magic 8 Ball

Bonus

Research the math library in Python.

Create a program that finds the length of the hypotenuse of a right triangle, given the two perpendicular sides.

Can this program be completed without using import math?