Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bfmcneill opened this issue Nov 28, 2018 · 1 comment

Comments

@bfmcneill
Copy link

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

@mikeckennedy
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants