mikeckennedy/python-jumpstart-course-demos

Video <<-- App 4: Journal app and file I/O: Complex conditionals and, or, and not

bfmcneill opened this issue · 1 comments

Howdy!

I was wondering what the consequence was to having the last elif statement in the run_event_loop method looking like the following. I took a guess before the video got to this point and I seem to get the same user experience. Thanks for the feedback, it's been a great course so far.
capture

Hi there. It looks REALLY close to the same as the code here:

while cmd != 'x' and cmd:
    cmd = input('[L]ist entries, [A]dd an entry, E[x]it: ')
    cmd = cmd.lower().strip()

    if cmd == 'l':
        list_entries(journal_data)
    elif cmd == 'a':
        add_entry(journal_data)
    elif cmd != 'x' and cmd:
        print("Sorry, we don't understand '{}'.".format(cmd))

But the difference is if you press x to exit. I think in your loop you will see two lines:

"Sorry we don't understand X"
"Done, goodbye"

Whereas in mine, you'll only see the last line on exit. Is that right from reading the image and executing it in my mind? :)

Best,
Michael