Today you’ll begin working on a command line utility which will mimic the functionality of a point of sale restaurant system using your basic Python tools and understanding of the basics of the language.
> character represents user input line and should be printed out with a trailing space.$ python snakes_cafe.py
**************************************
** Welcome to the Snakes Cafe! **
** Please see our menu below. **
**
** To quit at any time, type "quit" **
**************************************
Appetizers
----------
Wings
Cookies
Spring Rolls
Entrees
-------
Salmon
Steak
Meat Tornado
A Literal Garden
Desserts
--------
Ice Cream
Cake
Pie
Drinks
------
Coffee
Tea
Unicorn Tears
***********************************
** What would you like to order? **
***********************************
>
***********************************
** What would you like to order? **
***********************************
> Cake
** 1 order of Cake has been added to your meal **
> Cake
** 2 orders of Cake have been added to your meal **
> quit
Create a project named snakes-cafe.
Create a snakes_cafe.py file inside the project folder. Note the hyphen vs. underscore
Your file structure should look like this.
├── snakes-cafe
│ ├── README.md
│ └── snakes_cafe.py
Create a repository on Github with the exact name of snakes-cafe.
See the Github section of Lab Submission Instructions for additional details.
Refer to the Lab Submission Instructions for the complete lab submission process and expectations. You may have noticed many references to Lab Submission Instructions. That’s on purpose. Getting the steps exactly right is crucial. So make sure you follow them closely.
mkdir example-lab
cd example-lab
touch README.md
python3 -m venv .venv
NOTE: Replace python3 with a more specific version as needed.
Mac/Linux:
source .venv/bin/activate
Windows:
source .venv/Scripts/activate
mkdir example_lab
touch example_lab/example_script.py
Note the underscore vs hyphen
For example:
pip install favorite-library
pip freeze > requirements.txt
Should result in this file tree:
└── example-lab
├── README.md
├── requirements.txt
└── example_lab
└── example_script.py
Many labs will require automated testing. If your lab requires it, then install pytest or pytest-watch.
pip install pytest # or pytest-watch
pip freeze > requirements.txt
touch tests/__init__.py # (Note: 2 underscores on both sides.)
touch tests/test_example.py
Should result in a file tree like this:
└── example-lab
├── README.md
├── requirements.txt
├── example_lab
│ └── example_script.py
└── tests
├── __init__.py
└── test_example.py
Your project’s README.md should match the structure of the template README.
git init
touch .gitignore
Add .venv folder to .gitignore
git add .
git commit -m "first commit"
Create an EMPTY repository example-lab on Github. DO NOT initialize with README, license, or gitignore.
Those will be added soon.
The next screen will have a “Quick Setup” section with a URL available to copy. Copy it ;)
git remote add origin the_url_you_copied_that_ends_with_git
git push -u origin main
Now everything is wired up between the local machine and Github.
Submit a link to the README.md from your assignment branch in Canvas.
Any commits made to the submission branch will be updated in the PR.
In the event of assignment resubmission, submit the submission branch PR on canvas.
This step is optional early in the course. The instructor will inform you when it is required.
Setup “Github Actions” so that your code can be properly tested in Github as you make new pushes to your branches and pull requests to master.
Include the following YAML code:
name: Run Python Tests
on:
push:
branches:
- main
paths:
- "python/**"
pull_request:
branches:
- main
paths:
- "python/**"
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
working-directory: ./python
- name: Test with pytest
run: pytest -vv
working-directory: ./python
NOTE: This challenge is whiteboard only. Write out code as part of your whiteboard process, but don’t worry about creating external program files.
Write a function called reverseArray which takes an array as an argument. Without utilizing any of the built-in methods available to your language, return an array with elements in reversed order.
| Input | Output |
|---|---|
| [1, 2, 3, 4, 5, 6] | [6, 5, 4, 3, 2, 1] |
| [89, 2354, 3546, 23, 10, -923, 823, -12] | [-12, 823, -923, 10, 23, 3546, 2354, 89] |
| [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, …] | [199, 197, 193, 191, 181, … 7, 5, 3, 2] |
Once you’ve achieved a working solution, implement the same feature with a different methodology. (Hint: what different techniques do you have when working with arrays? Recursion, loops, indexes, modifying the array input directly…) In other words, use a different algorithm & pseudocode to solve the same problem. Then compare approaches for efficiency, readability, flexibility, etc.
In your open pull request, comment with the following checklist of tasks:
Bookmark and Review
Statement on why this topic matter as it relates to what I’m studying in this module:
Understanding that growth involves some level of discomfort and challenges and you might face a lot of it learning python.
In the context of the reading “Pain and Suffering,” describe the main challenges faced by beginners when learning Python and suggest at least two strategies for overcoming these obstacles.
Strategies to Overcome:
Collaborative Learning: collaborate with peers and engage in group discussions. Collaboration not only provides diverse perspectives but also helps in dealing with emotional challenges by fostering a sense of shared experience and collective growth.
Mindset Shift: shift perspective and view the challenges as opportunities for growth rather than obstacles. Emphasize the importance of building a positive mindset that acknowledges the pain of growth but also recognizes it as a temporary phase leading to valuable skills and a better future. Encourage setting clear goals
After reading “Beginners Guide to Big O,” explain the concept of time complexity and space complexity.
What exactly is the application of big o notation, where is it used?
Statement on why this topic matter as it relates to what I’m studying in this module:
Understanding the characteristics and performance of different data structures allows programmers to select the most appropriate one for a given problem.
What is 1 of the more important things you should consider when deciding which data structure is best suited to solve a particular problem?
How can we ensure that we’ll avoid an infinite recursive call stack?
I want to know more about advanced data structures like Graphs and Heaps
One of the most effective tools in adult learning is reflection. By writing coherent summaries of lessons learned, we cement that learning and deepen our understanding of a subject. It also helps us to measure our progress.
Maybe you’ve seen a graphic similar to this before?

This is a learning style model developed by researcher David Kolb, and it is a core principle in the way our curriculum is designed and our instruction is delivered at Code Fellows. Note the “Reflective Observation” component; it is that piece that is a primary differentiator between the way adults learn and the way children learn.
As an adult, learning is different for you now than it was when you were younger. Do a quick read of this article that describes the differences between andragogy (adult-focused learning) and pedagogy (child-focused learning).
Over the duration of this course, there will be a series of learning journal assignments where you will be prompted to reflect on your learning. The reflection is a critical part of adult learning, and the self-awareness that results is a key component of emotional intelligence. Initially, these journal assignments will give you prompts to get you started, but as time goes by, some assignments will be less structured so that you explore your thoughts with more self-determination and freedom.
Write a brief reflection on your learning today, or use the prompt below to get started.
Consider the following quote from the article linked above:
“[Adult learners] are deeply involved not only in planning but also in evaluating their learning, as they know what knowledge they want to acquire.”
In other words, you should continuously evaluate your learning, and your learning journal is an excellent way to keep track of that. How do you see yourself planning and evaluating your learning? What details will you record and/or measure? How often will you evaluate what you want to learn?