I am new to python. This is a small example of what I'm wanting to do in my code. I want to save the values of square and circle. So it will ask "do want to change the values..." you press one for square, and it goes from 0 to 1, then it ask again, you press two, then it goes up again to 2. I do not want globals in my program. I am reading post that say the answer to no-globals is to pass varibles to functions and make changes then return them. I dont think that would work with my while loop.
loopcounter = 0
square = 0
circle = 0
def varibleChanges(circle, square):
#global circle, square
print 'Would you like to change circle or square?'
print '1. circle' '\n' '2. square'
choice = raw_input('>>')
if choice == '1':
square = square + 1
elif choice == '2':
circle = circle + 1
print 'square: ', square
print 'circle: ', circle
while loopcounter <=2:
print 'this is the begining of the loop'
varibleChanges(circle, square)
loopcounter +=1
print "this is the end of the loop\n"
Would storing the varibles outside the code work, like writing to file, (I will have a save feature anyways) Or would it be best to rethink the code again?