Няма описание

alien.py 553B

123456789101112131415161718
  1. alien_0 = {'x_position': 0, 'y_position': 25, 'speed': 'medium'}
  2. print("Original position: " + str(alien_0['x_position']))
  3. # Move the alien to the right.
  4. # Figure out how far to move the alien based on its speed.
  5. if alien_0['speed'] == 'slow':
  6. x_increment = 1
  7. elif alien_0['speed'] == 'medium':
  8. x_increment = 2
  9. else:
  10. # This must be a fast alien.
  11. x_increment = 3
  12. # The new position is the old position plus the increment.
  13. alien_0['x_position'] = alien_0['x_position'] + x_increment
  14. print("New position: " + str(alien_0['x_position']))