Advertisement
NyteOwlDave

In-Order Walk

Feb 17th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def nextCell(s):
  2.   l = len(s)
  3.   row = ord(s[l-1:l])-ord('A')
  4.   col = int(s[0:l-1])+1
  5.   if (col > 12):
  6.     col = 1
  7.     row += 1
  8.     if (row > 7):
  9.       row = 0
  10.   row = chr(row + ord('A'))
  11.   return "{0}{1}".format(col,row)
  12.  
  13. print("3C => ", nextCell("3C"))
  14. print("12C => ", nextCell("12C"))
  15. print("12H => ", nextCell("12H"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement