Well, I also need instance variables for loops. For example, I have a variable which I set during one of the loops. But when the program loops over again, the local variable's value is erased. I would like the variable to stay the same (every time it loops until the program is quit) once the variable is set.
Instance variables are members of Python classes. To create an instance variable for a Python class, declare the variable inside the class's __init__ method.
From reading your question, it sounds like you want to use global variables, not instance variables. To create a global variable declare it outside a method. To modify a global variable inside a method, declare the variable as global in the method.
x = 0
x += 1
Using global variables should be avoided in most cases, especially for larger programs. For larger programs using classes and instance variables is better than using global variables, but you can get away with using global variables for small programs.