Python exercise: 4-1. Food: Think of three kinds of your favorite food and store the food names in a list. Use a for loo

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Python exercise: 4-1. Food: Think of three kinds of your favorite food and store the food names in a list. Use a for loo

Post by answerhappygod »

Python exercise:
4-1. Food: Think of three kinds of your favorite
food and store the food names in a list.
Use a for loop to print the name of each food.
Modify your loop to print a sentence using the name of the food
instead of printing just
the name, for example, "I like bananas."
Add a line at the end of your program, outside
the for loop, that states how much you like
food, for example, "I really enjoy food!"
4-2. Animals: Think of five different animals and
store the names of the animals in a list.
Use a for loop to print out the name of each
animal.
Modify your program to print a statement about each animal, such
as, "A dog would
make a great pet."
Add a line at the end of your program stating something these
animals have in common,
for example, "Any of these animals would make a great pet!"
4-3. Counting to Twenty:
• Use a for loop to print the numbers from 1 to
20, inclusive. • Use the sum() function to add
the numbers from 1 to 20.
4-4. Counting to One Million:
Make a list of the numbers from one to one million but do
not print the numbers!
Use min() and max() to show that the list
starts at one and ends at one million.
Use the sum() function to see how quickly Python can
add a million numbers.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply