Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- path = raw_input("Введіть шлях!")
- x = 0
- y = 0
- pt = []
- count = 0
- class Position:
- def __init__(self, x, y):
- self.x = x
- self.y = y
- for p in path:
- c = str(p)
- if c == 'r':
- x = x + 1
- count = count + 1
- elif c == 'l':
- x = x - 1
- count = count + 1
- elif c == 'u':
- y = y + 1
- count = count + 1
- elif c == 'd':
- y = y - 1
- count = count + 1
- t = str(count)
- t = Position(x, y)
- print 'x', t.x
- print 'y', t.y
- for i in int(count):
- n = str(i)
- if n.x == t.x and n.y == t.y:
- break
- print count
- #if c in count[]:
- #print 'Fail'
Add Comment
Please, Sign In to add comment