- This event has passed.
FRI – 7 PM – Indo – Intro to Python – Joel
March 22 @ 7:00 pm - 8:00 pm
Today we did:
- We worked on the second version of the magic 8-ball project using random.choice().
Homework:
- Copy the code from pages 138-139 (if you’re using the online pdf) and put the in a file called March25_FunctionsWithReturnValueHomework.
- Create a new file called March25_RandomHomework and inside,
- #1 Create a list called ‘fruits’ with 5 fruits of your choice, and randomly pick a fruit from that list. After that, simply print the randomly picked fruit.
- #2 Generate a random number between 1 and 6 that will represent the outcome of rolling a die. Store that random number in a variable, and print that variable.
- If you are confused, check your random file either on your device on in the google drive to see which function (random.choice or random.randint) you should use for number 3. Likewise, if you’re stuck on number 4, you can also check which function you should use.
- Remember, if you have an error where random is not defined, then you probably forgot to ‘import random’ in the top of your file.
If you have any questions, feel free to ask me at joel@ayclogic.com or Mr. Gamas at gamas@ayclogic.com.