Welcome to LQ and to the Programming forum!
To preserve formatting place your code snippets inside [CODE]...[/CODE]
tags. You may type those yourself or click the "
#" button in the edit controls.
As rtmistler has pointed out, it is not at all clear what you are trying to do, to those willing to help. Remember that the better you describe your problem, the better the help you will receive.
What the error is telling you is that the object "
rank" has not been defined within the interactive shell you are running. How that relates to the code snippet you pasted above is unknown to us.
Please review the
Site FAQ for guidance in asking well formed questions, then try to re-state your question in a way that others can better understand.