Skip to content

Commit 01ca8f8

Browse files
author
Scott Maher
committed
Initial commit for quiz.
0 parents  commit 01ca8f8

24 files changed

+1044
-0
lines changed

.gitignore

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158+
# and can be added to the global gitignore or merged into this file. For a more nuclear
159+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160+
#.idea/
161+
162+
# VS Code files for those working on multiple tools
163+
.vscode/
164+
.vscode/*
165+
!.vscode/settings.json
166+
!.vscode/tasks.json
167+
!.vscode/launch.json
168+
!.vscode/extensions.json
169+
*.code-workspace
170+
171+
# Compiled class file
172+
*.class
173+
174+
# Log file
175+
*.log
176+
177+
# BlueJ files
178+
*.ctxt
179+
180+
# Mobile Tools for Java (J2ME)
181+
.mtj.tmp/
182+
183+
# Package Files #
184+
*.jar
185+
*.war
186+
*.nar
187+
*.ear
188+
*.zip
189+
*.tar.gz
190+
*.rar
191+
192+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
193+
hs_err_pid*
194+
replay_pid*

README.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
```
2+
_ __
3+
.-. / |_ [ |
4+
_ __ .---. _ .--. __| |__ `| |-'.---. .---. | |--.
5+
[ \ [ ]/ /__\\[ `/'`\]|__ __| | | / /__\\/ /'`\] | .-. |
6+
\ \/ / | \__., | | | | | |,| \__.,| \__. | | | |
7+
\__/_ '.__.'[___]__ '-' \__/ '.__.''.___.'[___]|__]
8+
9+
.' ..] [ | [ |
10+
_| |_ .---. | | | | .--. _ _ __ .--.
11+
'-| |-'/ /__\\ | | | |/ .'`\ \[ \ [ \ [ ]( (`\]
12+
| | | \__., | | | || \__. | \ \/\ \/ / `'.'.
13+
[___] '.__.'[___][___]'.__.' \__/\__/ [\__) )
14+
15+
```
16+
# primera etapa
17+
18+
¡Bienvenid@s a la primera prueba del programa VélezReyes+ Tech Fellows 2024! We are so excited that you are here and to embark on this journey together.
19+
20+
As you can see, this journey will also be in _English_ and we hope that this process is also a great resource for you to practice your English and see it in action in technical contexts. If you are not entirely comfortable in English, we encourage you to use translation software, friends, anything! Please keep in mind that here at ver+ we value resourcefulness, a learning mindset, attention to detail, and care for each other above all else!
21+
22+
### Instructions
23+
24+
There are three parts to this challenge, each in their own folder: each part contains its own questions. Each part has its own README with some light instructions on what is expected of each question. As you will see, most of the questions involve editing the question file in place, and in certain circumstances, a test harness is provided.
25+
26+
**TO START**:
27+
_FORK_ the repository to commence the test. If you do not fork the repository, your participation will not be counted. Please DO NOT CLONE the repository, and make sure you fork it.
28+
29+
**TO SUBMIT**:
30+
_CREATE A PULL REQUEST_ from your fork to our main branch. Your pull request must be open and registered in GitHub before the deadline. We will not accept merge requests from branches on the main repository, so please make sure you do fork the repository.
31+
32+
### The deadline is Sunday, November 5th at 3:00pm Colombia.
33+
We will judge the timeliness of submissions by the timestamp of your pull request. Any pushes to the pull request AFTER the cutoff will NOT be considered. You will be notified of your results on November 8th.
34+
35+
```We wish you the best for this week!```
36+
37+
Remember that our team is here for you, and truly excited that each and everyone of you are here with the ambition and passion to transform both your lives and the lives of others through technology.
38+
39+
```
40+
_________ ____
41+
/ ____/ | / __ \
42+
/ /_ / /| |/ / / /
43+
/ __/ / ___ / /_/ /
44+
/_/ /_/ |_\___\_\
45+
46+
```
47+
48+
*What if I can't install the requirements on my localhost?*
49+
50+
We highly recommend that you find a way to complete this challenge locally. We have designed this to require minimal packages, and if you have access to a Linux terminal, you should be able to edit and run all the code. If you absolutely cannot do so at this stage, you can also use most online REPLs such as Github Dev or REPL.it which should support the packages needed. Please keep in mind that the second stage requires a proper localhost environment setup for full stack development.
51+
52+
*What if I don't understand certain instructions?*
53+
54+
Part of the test is seeing an existing code base and being able to navigate the documentation and files no matter what. We encourage you to use Google, translators, and to play around with the code until it makes more sense how to proceed. The ver+ team will unfortunately NOT be providing clarifications to the instructions.
55+
56+
*What if I discover a bug with the code?*
57+
58+
If you believe you've discovered a true error that would prevent anyone from completing the test, please message Karen Sun in the Slack channel. You should have received a link to the Slack channel if you are eligible for this stage of the test!
59+
60+
*What if I want to make changes to my pull request?*
61+
62+
Yay! That's the beauty of Git. If you create your pull request before the deadline and would like to make changes, go ahead and push new commits to your pull request. We will only judge the most recent code before the deadline. In fact, we encourage you to create a pull request early and make constant pushes.
63+
64+
*I found this repository. Can I make a submission?*
65+
66+
While you are free to use this repository to practice your engineering skills, only those who have been identified as eligible for this program and have been invited to our Slack program channel are eligible for the ver+ tech fellowship in 2024.
67+
68+
69+
_If there are questions not addressed here about the class, please put your questions into the `#etapa1-test` channel in Slack_

part1/README.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
```
2+
_______ __ _______ ___________ ____
3+
| __ "\ /""\ /" \ (" _ ") / " \
4+
(. |__) :) / \ |: | )__/ \\__/ /__|| |
5+
|: ____/ /' /\ \ |_____/ ) \\_ / |: |
6+
(| / // __' \ // / |. | _\ |
7+
/|__/ \ / / \\ \ |: __ \ \: | /" \_|\
8+
(_______) (___/ \___)|__| \___) \__| (_______)
9+
```
10+
11+
Part 1 is a set of 5 Python questions.
12+
You will need to have Python3.6 or better installed on your computer.
13+
14+
# Getting Started
15+
16+
To get started run the below commands. They will create a new Python3 virtual environment, activate it, and
17+
install the pytest testing library.
18+
19+
```
20+
python3 -m venv venv
21+
source venv/bin/activate
22+
pip install pytest
23+
```
24+
25+
*If you ever need to close your terminal and come back later:* You can enter the virtual environment from the same
26+
directory by typing `source venv/bin/activate`.
27+
28+
# How to Work on the Questions
29+
30+
Each question is a unique challenge.
31+
- Question 1 is about solving a bug in an existing tiny program.
32+
- Question 2 is about writing a simple function.
33+
- Question 3 is about implementing a class to create a magical oven.
34+
- Question 4 is will test your data and SQL abilities.
35+
- Question 5 is about changing the tables you worked with in Question 4.
36+
37+
Each question is in a file named something like, for example, `question3.py`. Every question also has VERY useful
38+
test cases in files like, for example, `question3_test.py`. The specific instructions for how to solve the question
39+
are in the file.
40+
41+
You can test if your solution is correct by running `pytest` against the test file. For example:
42+
```
43+
pytest question3_test.py
44+
```
45+
46+
If the test file passes then you have succeeded. This is how you will be graded.
47+
It is highly recommended that you read the test file to know the expected output of your questions!
48+
You can learn more about how pytest works here: https://docs.pytest.org/en/7.4.x/contents.html

part1/pets_db.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import sqlite3
2+
3+
TABLE_SCHEMA = """
4+
CREATE TABLE animals (
5+
animal_id integer,
6+
name text not null,
7+
species text not null,
8+
age integer not null
9+
);
10+
CREATE TABLE people (
11+
person_id integer,
12+
name text not null,
13+
age integer not null,
14+
favorite_color text not null
15+
);
16+
CREATE TABLE people_animals (
17+
owner_id integer not null,
18+
pet_id integer not null
19+
);
20+
"""
21+
22+
ANIMALS = [
23+
(1, "petey", "gray whale", 38),
24+
(2, "leyla", "gray whale", 43),
25+
(3, "thommy", "giant parrot", 21),
26+
(4, "ricky", "lobster", 5),
27+
(5, "martin", "cow", 12),
28+
(6, "shannon", "cow", 14),
29+
(7, "randolph", "lemur", 67),
30+
]
31+
32+
PEOPLE = [
33+
(1, "scott", 23, "green"),
34+
(2, "bessie", 22, "pink"),
35+
(3, "karen", 27, "orange"),
36+
]
37+
38+
PEOPLE_ANIMALS = [
39+
(1, 4), # scott, ricky
40+
(2, 4), # bessie, ricky
41+
(2, 2), # bessie, leyla
42+
(2, 7), # bessie, randolph
43+
(3, 3), # karen, thommy
44+
(3, 5), # karen, martin
45+
]
46+
47+
###
48+
# Utility functions for interacting with the database.
49+
# No need to look any further!
50+
###
51+
52+
DB_NAME = "quiz_pets"
53+
54+
def get_connection():
55+
return sqlite3.connect(DB_NAME)
56+
57+
def drop_db():
58+
with get_connection() as con:
59+
for table in ["animals", "people", "people_animals", "favorite_foods"]:
60+
con.execute(f"drop table if exists {table}")
61+
62+
def create_db():
63+
drop_db()
64+
65+
with get_connection() as con:
66+
con.executescript(TABLE_SCHEMA)
67+
con.executemany("INSERT INTO animals VALUES(?, ?, ?, ?)", ANIMALS)
68+
con.executemany("INSERT INTO people VALUES(?, ?, ?, ?)", PEOPLE)
69+
con.executemany("INSERT INTO people_animals VALUES(?, ?)", PEOPLE_ANIMALS)

0 commit comments

Comments
 (0)