.py
files containing your work. (If you upload a screenshot or other file format, you won't get credit.)This homework assignment must be submitted in Gradescope by 10am CST on Tuesday, November 16, 2021.
This homework assignment focuses on regular expressions, software licensing, and testing with pytest.
Collaboration is prohibited, and you may only access resources (books, online, etc.) listed below.
The course materials and other resources you are allowed to refer to for this homework are:
(Lecture videos are not linked on worksheets, but are also useful to review while working on worksheets. Video links can be found in the course course Blackboard site.)
This homework assignment has 2 problems, numbered 2 and 3. Thus the grading breakdown is:
Points | Item |
---|---|
2 | Autograder |
4 | Problem 2 |
4 | Problem 3 |
10 | Total |
Ask your instructor or TA a question by email, in office hours, or on discord.
Gradescope will show the results of the automated syntax check of all submitted files as the score for problem 1.
In the 1970s and 1980s, one of the most popular series of components in digitial electronic circuits were the 7400 series of integrated circuits. They were used extensively in early personal computers, for example. They are still used in some electronics applications. Here's a picture of a few of them:
There are many parts in this series, with numbers like 7404
and SN74LS02N
and 74F08
.
More precisely, the format of the part number is
Write a program hwk12prob2.py
that takes a filename as its command line argument. It should read the lines of the specified text file and look for names of 7400-series ICs matching the specs above. It should print each name it finds.
If test.txt
contains
I was thinking about the clock module we discussed, and I think by adding a couple of JK-type
flip-flops (maybe 74LS107 or SN74LS72N? not sure...) we could convert the momentary pushbutton
input to a toggle, without using the more mechanically complicated sustained switch your BOM
originally called for. But I agree we should keep using dedicated inverters on a 7404 rather
than repurposing an unused NAND from the 74HC00, since it will be a pain to interface the TTL
and CMOS parts to make that work.
then the output of
python3 hwk12prob2.py test.txt
would be
74LS107
SN74LS72N
7404
74HC00
Create test_dice.py
, a module containing pytest-compatible functions to test the module dice.py we created in lecture 23.
The tests should do the following:
"heads"
or "tails"
For full credit, your module must have three passing tests that can be discovered and run by pytest
if test_dice.py
and dice.py
are in the same directory. Also, if test_dice.py
is run as a script, it must do nothing at all.
test_dice.py
is dice