American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

6:30pm – Intro to Python – Roland

April 30 @ 6:30 pm - 7:30 pm

Today We Did

      1. Function Review
        1. print_first_item_in_list
        2. return_second_item_in_list
      2. random
        1. import random
        2. random.randint(start, end)
        3. random.choice(list)
      3. Magic8Ball V1
        1. Using random.randint() to make a Magic 8 Ball Program

Homework:

Submit the following file into your Google Drive Homework Folder

      1. Make a new file called Magic8BallV2.py
        1. As we did with Magic8BallV1.py in class, we want to recreate our program except instead of using random.randint(), we want to make it with random.choice()
        2. Copy over your Magic8BallV1.py program and do the following below
          1. Delete everything involving random.randint() and the if-statements following it
          2. Make a new list called “choices”, and fill it with 8 different responses you want your 8-ball to say
          3. Use random.choice() to get a random response from your choices list and store it into another variable
          4. Print out that variable (whatever you decide to name it)

If you have any questions, feel free to email me at rolandyang@ayclogic.com

Details

Date:
April 30
Time:
6:30 pm - 7:30 pm
Verified by MonsterInsights