Let \( x \) be the number of games Ahmadullah’s team played last season.
According to the problem, we know that:
\[ 21 = \frac{1}{3}x + 12 \]
To isolate \( x \), we first subtract 12 from both sides:
\[ 21 - 12 = \frac{1}{3}x \]
Simplifying the left side gives:
\[ 9 = \frac{1}{3}x \]
Next, to eliminate the fraction, we multiply both sides by 3:
\[ 9 \times 3 = x \]
Calculating the left side yields:
\[ x = 27 \]
Thus, Ahmadullah’s basketball team played 27 games last season.