Using while loop to add elements in a list without overwriting previous elements
<p>I'm working with events and database classes.</p>

<p>I created a while loop that will keep appending my event (objects) in my database.
Also there is a command that will keep running in the if main block as long as the user doesn't type the command "exit".</p>

<p>My problem is that whenever the command asks for an event to be added, the previous gets erased per iteration.</p>

<p>The word "event" acts like the command "exit" So whenever this word is typed along with an event string (I've already implemented a function that will convert event strings to event objects). It will keep adding an event object into the Database. </p>

<pre><code>def parse(command):
    '''Parse a command string.'''
# gist of event class Event(description, time, date, duration) not part of this function event string could be: '"Movie night" today 10:00pm'

    store_event = Database() # where I should save my event objects
    cmd_str = command.split() 
    a_lst =[]

    while cmd_str[0] == "event": #while event is a command that the user wants
        cmd_str = command.split()
        cmd_str.pop(0) # I don't need the word "event" just the event string after it.
        new_str = ' '.join(cmd_str)
        an_event = parseevent(new_str) # converts string object to event objects
        a_lst.append(an_event)
</code></pre>

<p>Thanks!</p>
