Worksheet 1 - List (Answers)

 Fill-in-the-blanks


1. collection, related

2. variables, list

3. horizontally

4. brackets

5. comma

6. [initial values]

7. [21, 22, 23, 24, 25]

8. []

9. append

10. zero

11. 0

12. -1

13. 22

14. 24

15. [21, 22, 23, 24, 25]

16. slice

17. included, excluded

18. [23, 24]

19. stepper

20. [22, 24]

21. 0

22. the size of the list

23. index of item to be modified, new value

24. [21, 5, 23, 24, 25]

25. append

26. end

27. del

28. third


Short questions


1. A list is a collection of related data stored in one variable, making data easier to manage.

2. `numbers = [1, 2, 3]`

3. Square brackets `[ ]`

4. Index 0

5. `23`

6. `25`

7. `items = []`

8. `[22, 23, 24]`

9. It includes items from index 2 up to (but not including) index 4.

10. `[22, 24]`

11. `userAge[1] = 5`

12. a) Adds 99 to the end of the list

    b) Removes the item at index 2

13. An index is a placeholder for a value.

No comments:

Post a Comment