Fruit Basket Program
Lara is preparing a fruit basket for her family’s picnic. She starts with a list of fruits she already has at home: 'apple'
, 'mango'
, and 'banana'
.
She wants to:
See all the fruits she currently has.
Check which fruit is the first in the list.
Add 'pineapple'
to her basket.
Find out how many fruits she now has in total.
Task:
Write a Python program that helps Lara complete all these steps using a list.
Your program should:
Create a list called fruits
with the three starting fruits.
Print the entire list of fruits.
Print the first fruit in the list.
Add 'pineapple'
to the list using .append()
.
Print the updated list.
Use len()
to count how many fruits are now in the list and print the result.
We’re always looking for international STEM educators to join our team. If you are interested, please send us a mail and we’ll get back to you!
If you have any questions, kindly send us a mail. Don’t forget to follow and like all our social accounts to get updates on competitions!