This question is mostly becase I cannot find any good Python examples on how just to keep a main instance etc, and I am trying not to grow into any bad habits, like I did when I started PHP. I started Python about 3 hours ago, have been going at it, mostly console, then I decided to try the lists when I was watching https://www.youtube.com/watch?v=2IEePwMAb5Y&list=PL0A9588F9B2C45B3A . It mostly kills that the code looks horrendously awful and presumably incorrect. Is there any places I can find some simple applications written as Python was intended to look and run?
Background: I wanted to think of a small little application that would just let me see if I could cycle and play with the arrays. So I made a grocery list organizer.
i = 0
v = []
vara = None
def view():
indx = 1
for i in v:
print "Grocery #" + str(indx) + ": " + str(i)
indx += 1
while vara != "end" and vara != "exit":
vara = raw_input("Please enter a grocery: ")
vara = str(vara)
if vara == "view":
view()
elif vara[len(vara)-4: len(vara)] == " del":
key = vara[0:len(vara) - 4]
if key in v:
v.remove(key)
print "Deleted: " + key
else:
print "Error, " + key + " was not found in your list"
elif (vara != "end" and vara != "exit") and len(vara) > 0:
v.append(vara)
view()
It is more important for me to have the places to find some good examples, that is the most important. Also how would I create the instance to start and end if you could. Thank you very much if you can.