- This event has passed.
6:30pm – Intro to Python – Roland
April 30 @ 6:30 pm - 7:30 pm
Today We Did
- Function Review
- print_first_item_in_list
- return_second_item_in_list
- random
- import random
- random.randint(start, end)
- random.choice(list)
- Magic8Ball V1
- Using random.randint() to make a Magic 8 Ball Program
- Function Review
Homework:
Submit the following file into your Google Drive Homework Folder
- Make a new file called Magic8BallV2.py
- 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()
- Copy over your Magic8BallV1.py program and do the following below
- Delete everything involving random.randint() and the if-statements following it
- Make a new list called “choices”, and fill it with 8 different responses you want your 8-ball to say
- Use random.choice() to get a random response from your choices list and store it into another variable
- Print out that variable (whatever you decide to name it)
- Make a new file called Magic8BallV2.py
If you have any questions, feel free to email me at rolandyang@ayclogic.com