Advertisement
Guest User

sdaf

a guest
Sep 15th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. a_str = "x"
  2. position = int(input("Input a position between 1 and 10: "))
  3. a = 0
  4. b = 9
  5. c = 0
  6. d = 0
  7.  
  8. for i in range(1,10):
  9. new_str = a_str * (a) + "o" + a_str * b
  10. if i == position:
  11. print(new_str)
  12. c = a
  13. d = b
  14.  
  15. a += 1
  16. b -= 1
  17.  
  18. print("l - for moving left")
  19. print("r - for moving right")
  20. print("Any other letter for quitting")
  21.  
  22. while True:
  23. if move !="r" and move !="l":
  24. break
  25. else:
  26. for i in range(1, 10):
  27. def main_str(l):
  28. if move == "l":
  29. l = a_str * (c-i) + "o" + a_str * (d+i)
  30. print(l)
  31. return l
  32.  
  33. def my_str(r):
  34. if move == "r":
  35. r = a_str * (c+i) + "o"+ a_str * (d-i)
  36. print(r)
  37. return r
  38.  
  39.  
  40.  
  41. move = input("Input your choice: ")
  42. l = main_str(move)
  43. r = my_str(move)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement