# Tutor profile: Meg F.

## Questions

### Subject: Python Programming

A group of rabbits is known as a colony or nest. Write a Python function called $$count\_ ears$$ that takes the number of bunnies in a single colony as an integer and $$recursively$$ determines the total number of bunny ears in that colony (you can safely assume that every bunny has only two ears).

Because this question asks us to write a recursive function, we first need to have a solid grasp on what recursion is before we can answer it. Recall that recursive functions are functions that can call themselves, potentially repeated times. They also must include a so-called "base case" that will allow the function to complete. Here we want to count up the total number of ears in a rabbit colony, without iteration. How might we do this? Let's start with what we know. We need to set up a function called $$ count\_ears$$ that takes an integer representing the number of rabbits in the colony (that we'll call $$number\_of\_rabbits$$) and calculates the total number of ears. Let's use a few concrete examples to help us. We know that if $$number\_of\_rabbits = 0$$, we must have 0 total ears, so $$count\_ears(0)$$ should return $$0$$. This is a good base case! What happens if we have 1 rabbit? The function needs to return $$2$$. What about 2 rabbits? This is the equivalent of the number of ears on that rabbit, plus the other rabbit's ears: $$2 + count\_ears(1)$$. Let's put this all together to create a function: def count_ears(number_of_rabbits): # base case if number_of_rabbits == 0: return 0 # recursive case -- we have ears on rabbits left to count! else: return 2 + count_ears(number_of_rabbits - 1) Try out a few test cases with this function to convince yourself that it works!

### Subject: Natural Sciences

How about a chemistry question! Please write the equilibrium expression for this reaction that is in equilibrium: $$NH_4NO_3(s)⇌N_2O(g)+2H_2O(g)$$

Recall that an equilibrium expression is represented by the products of a reaction, divided by the reactants, each of which is raised to its stoichiometric coefficient. For example, for the reaction $$aA + bB ⇌ cC + dD$$, we would write the expression as: $$ K = \dfrac{[A]^a[B]^b}{[C]^c[D]^d}$$ For this particular problem, we also need to remember only gaseous and aqueous components of a reaction are included; we don't need to include pure solids. Given the equation above, we know the $$[H_2O]$$ term must be squared because it has a stoichiometric coefficient of 2 in the equilibrium reaction. Also notice that $$NH_4NO_3$$, the only reactant, is a solid and will not be included in the expression. Hence, we can write the equilibrium reaction as simply: $$K=\dfrac{[N_2O][H_2O]^2}{1}$$ or more simply, $$K=[N_2O][H_2O]^2$$.

### Subject: Algebra

Sally sold $1,145 worth of tickets for a school play. Adult tickets cost $7, children's tickets cost $4 and senior tickets cost $5. If Sally sold 15 more adult tickets than children tickets and she sold three times as many senior tickets as children tickets, how many children's tickets did she sell for the play?

Let's start by trying to represent the total number of tickets sold. Here, we know that there are three types of tickets: adult ($$A$$), children ($$C$$, the value we are trying to find in this problem) and senior ($$S$$), so we could decide to write the total number of tickets ($$T$$) as: [1] $$T = A + C + S$$ OK! That's a good start. But now, we have four separate variables, and we don't actually know the values of $$S$$, $$A$$ or $$C$$ just yet. Let's make our lives more simple and see if we can use what we know to write this same expression, but with only one variable. Since we are solving for $$C$$, we'll use that. The question tells us that Sally sold 15 more adult tickets than children's tickets, so we know this expression must be true: $$ A = C + 15 $$. We also know that three times as many senior tickets were sold in comparison to children's tickets, so this expression must be true: $$ S = C * 3 $$. Now that we know $$A$$ and $$S$$ in terms of C, let's try using that equation again, plugging in these expressions. [2] $$ T = (C + 15) + C + (C * 3) $$ This is a good start, but we still don't know the value of $$T$$ OR $$C$$, so this equation isn't going to help us get to the value of $$C$$, even if it helps us understand the problem better. To find $$C$$, we are going to need another set of equations. Let try writing an equation representing the total dollar value of the tickets sold, $$D$$: [3] $$ D = (Cost_{Adult-Ticket} * A) + (Cost_{Child-Ticket} * C) + (Cost_{Senior} * S)$$ Fortunately, the question provides us the prices per ticket (the $$Cost$$ variables in the equation above) as well as the total sold, $$D$$. Let's plug that information in: [4] $$ 1,145 = (7 * A) + (4 * C) + (5 * S)$$ Now we are getting closer to finding $$C$$! Notice how this equation looks a lot like equation [1] and recall that we already know $$S$$ and $$A$$ in terms of $$C$$. As we did to create equation [2], let's plug in those expressions now. [5] $$ 1,145 = (7 * (C + 15)) + (4 * C) + (5 * (C * 3))$$ Notice how equation [5] is now written entirely in terms of $$C$$; this means we can do some simple algebra and rearrange the values to solve for C. Here it is step-by-step: Start by simplifying the values in the parentheses: [6.1] $$ 1,145 = (7C + 105) + (4C) + (15C) $$ Now simplify, combining values where possible: [6.2] $$ 1,145 = 26C + 105 $$ Get only $$C$$ on one side of the equation: [6.3] $$ (1,145 - 105) / 26 = C $$ Now get out your calculator and solve the right side! [6.4] $$ C = 40$$ By solving for $$C$$, we just finished the problem! Sally must have sold 40 children's tickets.

## Contact tutor

needs and Meg will reply soon.