Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. """
  2. I have a string (game_string) that jumbles its dollar signs (in the format ".$.$.$.$." with a total of exactly 9 characters). Since it jumbles I can have "$.$.$.$.." or ".$.$.$$.." or ".$$.$.$.." ... you get the idea. I have a function:
  3. """
  4. def move_dollar_to_the_left(game_string, position_number, to_move):
  5.    
  6.     return game_string
  7. """
  8. This function is supposed to move a dollar sign to the left by the amount the to_move is set. So for instance:
  9.  
  10. 123456789
  11. ..$.$..$$
  12.  
  13. I want to move the 8th dollar sign to the left by 1 so the result will be:
  14.  
  15. 123456789
  16. ..$.$.$.$
  17.  
  18. How do I make sure that the game_string is returned in the change format? i.e. the dollar sign has been moved to where the user wants to and it returns the final outcome
  19. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement