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
- for p in path:
- c = str(p)
- if c in pt:
- print 'Fail'
- else:
- if c == 'r':
- x = x + 1
- pt.append(x)
- count = count + 1
- elif c == 'l':
- x = x - 1
- pt.append(x)
- count = count + 1
- elif c == 'u':
- y = y + 1
- pt.append(y)
- count = count + 1
- elif c == 'd':
- y = y - 1
- pt.append(y)
- count = count + 1
- print x
- print y
- print pt
- print count
- #if c in count[]:
- #print 'Fail'
Add Comment
Please, Sign In to add comment