Rectangles
From Exercism PythonMITOriginal pagePython1 class period1 exercise14 graded tests
README.md
Rectangles
Instructions
Count the rectangles in an ASCII diagram like the one below.
+--+
++ |
+-++--+
| | |
+--+--+
The above diagram contains these 6 rectangles:
+-----+
| |
+-----+
+--+
| |
| |
| |
+--+
+--+
| |
+--+
+--+
| |
+--+
+--+
| |
+--+
++
++
You may assume that the input is always a proper rectangle (i.e. the length of every line equals the length of the first line).
Open the
01folder and editmain.py. Run Tests checks it.
For teachers
Rectangles
Students solve Exercism's “Rectangles” Python exercise in CS Room, with Exercism's own tests.
- Time: 1 class period
- Tests: 14, set up for you when you import the lesson
- Practices: iteration, itertools, sequences