Practice
Food
Start with an empty list called
food
. Ask the user to enter either a fruit, a vegetable, or a junk food item. Do this 10 times, and each time, the question you ask should be selected randomly. Add each of their answers to the list, sort the list alphabetically, and then display the final list by printing each item on a separate line.Fortune
Store 6 fortune cookie messages, and display a random one each time the user runs the program. Assume that you DON'T know how many messages are in the list.
(Hint: You're randomly choosing the index to access)
Copyright © 2021 Code 4 Tomorrow. All rights reserved.
The code in this course is licensed under the MIT License.
If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.