Guest User

Untitled

a guest
Nov 21st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. path = raw_input("Введіть шлях!")
  3.  
  4. x = 0
  5. y = 0
  6.  
  7. pt = []
  8. count = 0
  9.  
  10. for p in path:
  11. c = str(p)
  12. if c in pt:
  13. print 'Fail'
  14. else:
  15. if c == 'r':
  16. x = x + 1
  17. pt.append(x)
  18. count = count + 1
  19. elif c == 'l':
  20. x = x - 1
  21. pt.append(x)
  22. count = count + 1
  23. elif c == 'u':
  24. y = y + 1
  25. pt.append(y)
  26. count = count + 1
  27. elif c == 'd':
  28. y = y - 1
  29. pt.append(y)
  30. count = count + 1
  31.  
  32.  
  33.  
  34. print x
  35. print y
  36. print pt
  37. print count
  38.  
  39.  
  40. #if c in count[]:
  41. #print 'Fail'
Add Comment
Please, Sign In to add comment