diff --git a/docs/day5.md b/docs/day5.md index 4c7e0b7..5d484fb 100644 --- a/docs/day5.md +++ b/docs/day5.md @@ -335,4 +335,28 @@ If we want our menu functions to be useful outside our menu app we have some wor 11. Type `people = menu.list_people()` and press ++enter++. You should see `None` print. 12. Now type `update = menu.update_people()` and press ++enter++. Nothing should print. 13. Wait a moment for "successfully updated people." to print to the terminal -14. Type `people = menu.list_people(update)`. Your people should list! You successfully turned your menu into an importable package! \ No newline at end of file +14. Type `people = menu.list_people(update)`. Your people should list! You successfully turned your menu into an importable package! +15. Type `exit()` to exit. + +### Using our imported menu + +For our last trick we'll use our menu functions in a new program. + +1. Create a new file named "print_people.py" + + ![print_people](img/day5/print.gif) + +2. Add the following: + + ```python + from menu import update_people, list_people + from concurrent.futures import wait + + update = update_people() + wait([update]) + list_people(update) + ``` + +3. Type `python print_people.py` and press ++enter++ to run your program. You should see your people print after a while. + +Congratulations! You've just imported a program you wrote to communciate with an API and used it to do something automatically. \ No newline at end of file diff --git a/docs/img/day5/print.gif b/docs/img/day5/print.gif new file mode 100644 index 0000000..6757608 Binary files /dev/null and b/docs/img/day5/print.gif differ