Adding, Changing, and Removing Elements in a
List
The lists you will mostly create in Python are dynamic in nature. This
means you have to build the list, add elements to it, and remove it in the
course of running your program. For instance, you may decide to create a
game where the player must shoot birds flying. You may record the first set
of birds in a particular list before removing each bird that is shot down.
Once a new bird appears, it is added to the screen. Your bird lists will
increase, whereas the length will decrease throughout the game.
Do'stlaringiz bilan baham: |