21 May Saturday 16:30 Python Homework 05.18.
Question 1.
We have a list of following:
zoo = [‘monkeys’, ‘tigers’, ‘pandas’, ‘penguins’, ‘giraffes’, ‘hippos’, ‘bears’]
how to retrieve a slice of list zoo, so you can get the following result?
[‘monkeys’, ‘pandas’, ‘giraffes’, ‘bears’]
Question 2.
How to get average number of the following list mynumber?
mynumber = [‘3’, ‘6’, ‘2’, ‘8’, ‘9’, ’10’, ’30’]
Hint:
- We can use len(mynumber) to get how many items in the list
- Be careful about data type of the item in the list
Sorry, the comment form is closed at this time.