Advertisement
Gokulakrishnan

Step counter

Sep 14th, 2020
1,221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. a = [1234, 4321]
  2. b = [2345, 3214]
  3.  
  4. step = 0
  5. for idx, _ in enumerate(a):
  6.     x = [int(i) for i in str(a[idx])]
  7.     y = [int(i) for i in str(b[idx])]
  8.     for i, _ in enumerate(x):
  9.         t1 = int(x[i])
  10.         t2 = int(y[i])
  11.         step += abs(t1-t2)
  12. print(step)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement