PyTamaro is often used to teach complete novices. For them, writing Python code on a computer can be challenging. To support novices in reasoning about a graphic and its composition, we developed TamaroCards. Each Python function, constant, or operator is represented by a card. The cards can be arranged on a table to compose a Python expression that corresponds to a graphic.
Literals are white empty pieces of paper, constants are blue rectangles, functions are red rounded rectangles, and operators are green circles.
Function cards are the most important. They are needed to produce or compose graphics. They represent calls to functions such as rectangle. Functions have parameters (arrows on the left), and we need to provide an argument for each parameter. We use cards to specify the arguments. Some arguments can simply be given literally, using an empty white Literal card onto which students write the corresponding literal value (such as 250, or "ciao"). For other arguments we want to use constants, such as the predefined constants for the base colors (e.g., red) We provide Constant cards for those. More advanced TamaroCard expressions may involve operators (like +, -, *, and /). We provide Operator cards for Python's most important unary, binary, and ternary operators.
To express a computation (i.e., the creation of a graphic), students connect together individual cards into an expression. They can place cards next to each other, and where necessary they can draw connecting lines between them.
To enable the drawing of connecting lines (and possible annotations), it is best to arrange the cards on a big piece of paper. We found that taping packaging paper on top of students' desks works particularly well.
The evaluation of a TamaroCard expression flows from left to right. Each constant, function, and operator emits a value on its right. Function arguments enter functions from the left, and, similarly, operands enter operators from the left.
Students can annotate the visual expression with the values emitted by the cards. They don't necessarily need to annotate each card: showing the values produced by the literal cards (which literally are the values written on the card) doesn't add any information; and showing the values produced by the constant cards (like colors) may not add much either. We usually focus on annotating values that are graphics, either by drawing that graphic, or by producing and placing a paper cut-out of that graphic.
Once students understand the meaning of cards and their compositions, it makes sense to transition from TamaroCards to Python source code.
We can translate a TamaroCard expression into a Python source expression using a systematic approach: a depth-first traversal of the tree. We draw a line (let's call it a "street") through the tree to make the traversal explicit. We start at the root of the tree (the rightmost card). Whenever we visit a function card for the first time, we write down the function's name followed by an opening parenthesis. Between each of a card's arguments, we write down a comma. And when we visit the card the last time, we write down a closing parenthesis.
When using the TamaroCards, we provide each student (or student team) with the "documentation" in the form of a few printed pages.
Each documentation page shows a specific set of cards. These pages correspond to the library and language documentation: they explain what each function, constant, or operator does. The explanations are provided in a visual form: showing example arguments and return values of functions, example operands and results of operators, and the specific values of constants. This documentation should be sufficient to remember how to use the cards.
Students use the documentation pages as a reference when they try to understand the meaning of a specific card. Using these pages is training students to use reference documentation. We often initially distribute the Primitives and Colors pages, then the Combinators page, and later provide more pages as needed.
The six sheets contain cards arranged in a way so they can be printed and easily cut out. The sheets contain more copies of more commonly needed cards.
Note that the individual cards, unlike the documentation, do not contain any annotations on parameters, return values, or constant values. This is akin to code: when you call a function, you just write its name and provide arguments.
We recommend printing the above sheets and cutting out the cards. However, if needed, one can download the ZIP file which contains an individual PDF, SVG, and PNG file for each card. This can be helpful, e.g., if you use a whiteboard application to work with the cards.
Packaged in a ZIP file
In some situations it can make sense to include task-specific subsets of the documentation in teaching material. For example, you may write a Word document with an exercise for your students, and include the documentation of just those cards that are needed for that exercise. For this purpose, we also include individual pictures files of the documentation of each card. You can download the ZIP file which contains individual PDF, SVG, and PNG documentation pictures.
Packaged in a ZIP file
TamaroCards are designed for composing relatively simple Python expressions, mostly involving calls to PyTamaro functions. However, when including the function definition cards (from the "Names" card sheet), and the if-else card (from the "Operators" card sheet), TamaroCards actually represent a Turing-complete programming language!
You can implement any algorithm with TamaroCards. Even algorithms for which you normally would use loops! Why? Because loops are not the only way to repeat computations. There are other ways, one of them being recursion. And TamaroCards could be used to define recursive functions.
TamaroCards focus on a functional subset of Python: they contain pure functions (except show_graphic) and immutable variables (which we call constants). We recommend to use TamaroCards at the very start of a programming course for explaining pure expressions, constant definitions, and the definition of pure functions.
And once you introduce imperative Python features, such as mutable variables or loops in Python, you go beyond the TamaroCard notional machine. You can still use them, but only to reason about the pure and immutable parts of the code.
Teaching students to compose programs using TamaroCards, and translating TamaroCard expressions to Python code systematically, helps to combat known Python programming misconceptions, such as OutsideInFunctionNesting, NoAtomicExpression, and ParenthesesOnlyIfArgument.
The "Expression as Tree" notional machine visually represents expressions as trees. Expression Tutor is an online platform built around that notional machine. It's goal is to help students understand the structure, evaluation, and typing of expressions. While the expression trees in Expression Tutor look different from TamaroCard expression trees, they are equivalent in many ways. TamaroCards are a specialized, unplugged, variant of the "Expression as Tree" notional machine, with a focus on expressions that are used to produce PyTamaro graphics.
The PyTamaro API currently exists in four different natural languages: English, German, Italian, and French. Each TamaroCard shows its function or constant name in three of these supported languages (English, German, and Italian). This is ideal for multi-lingual environments. A future version may include the French names as well.
You can find the prior version of TamaroCards here:
August 2023
PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version 4735132 (Sat, 12 Oct 2024 10:20:26 GMT)